Approximate Results Count Search

The "Approximate Results Count" feature enables users to perform a search that returns an estimate of the total number of products within a specific similarity score range. This feature is useful for filtering and narrowing down search results based on how closely they match the query.

How It Works:

The search method accepts a total_counts object, which defines the similarity thresholds for the search, and a text field, which contains the search query. The similarity score for each product is measured on a scale from 0 to 1, where 1 represents a perfect match. Users can specify a range by setting the min and max thresholds to filter the products within the desired similarity range.

total_counts: An object containing two float values:

  • min_score_threshold: The minimum similarity score threshold (a float value between 0 and 1).
  • max_score_threshold: The maximum similarity score threshold (a float value between 0 and 1).
    text: A string representing the search query.

Once the request is sent, the system returns a single number, total_count, which represents the number of products that have a similarity score between the defined min_score_threshold and max_score_threshold values.

Example:

Request:

{
  "text": "summer shoes",
  "total_counts": {
    "min": 0.7,
    "max": 0.9
  }
}

Response:

{
   "total_count": 42
}

In this example, a request is made to find products related to "summer shoes" with a similarity score between 0.7 and 0.9. The response returns a total_count of 42, indicating that 42 products fall within this similarity range.