- Type:
enum<integer> | boolean - Default:
false - Scope:
settings,search
distinct parameter controls how many variants of a record are shown
when multiple records share the same value for the attribute defined in
attributeForDistinct.
This lets you group and deduplicate search results.
Options
false | 0
No grouping or deduplication. All matching records are shown.
This is the default.
This is the default.
true | 1
Returns only the most relevant record from each group.
This is useful when you want to show one result per unique product, article, or listing.Only the most relevant variant is shown for each record group.
2 | 3 | 4
Returns the top 2, 3, or 4 records for each group.
-
Avoid grouping with promoted records,
as this can lead to wrong
nbHitsvalues and broken faceting. -
When
distinctis greater than 1:hitsPerPagecontrols the number of groups.- Up to
hitsPerPage × distincttotal hits can be returned. - The response field
nbHitsreflects the number of groups, not total records.
Usage
attributeForDistinctdefines how records are grouped.distinctdefines how many records per group are shown.- If
attributeForDistinctis not set,distinctis ignored. - To ensure accurate facet counts when
distinctis applied, use theafterDistinctmodifier when declaringattributesForFaceting.
Example
Current API clients
Current API clients
Legacy API clients
Legacy API clients