Resources Relevance & Tuning

Managing Variants

Manage multiple variants effectively to handle a common problem in a UI.

How to display variations of a single product without hiding other products. Without handling variations, all variants of the best ranked result would show at the top of the search results, followed by all variants of the next ranked product.

You can group all variations using the distinct setting.

With the distinct setting, you retrieve the best ranked variation for each item. To determine which variation ranks best, use custom ranking. For example, add an attribute number_of_sales (descending) to the custom ranking. Now, for each product, the best-selling variation is retrieved from the index.

To group variations of the same item with distinct:

  1. Go to the Index page in the Algolia dashboard
  2. Select your index
  3. Go to the Index settings
  4. Select Searchable attributes
  5. Add searchable attributes: add all attributes describing the variants, such as model, type, and color attributes.
    Variant
  6. In the Search Behavior section, select Deduplication and Grouping
    Variant
  7. Set Distinct to true
  8. Select one Attribute for Distinct to deduplicate the records, for example,  model .
  9. Review and save the settings
    Variant