facetingAfterDistinct
false
'facetingAfterDistinct' => true|false
Can be used in these methods:
search,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
browse,
searchForFacetValues,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
Browse,
SearchForFacetValues,
GenerateSecuredApiKeys,
AddApiKey,
UpdateApiKey
Search,
browse,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
BrowseObjects,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
browse index,
search into facet values,
generateSecuredApiKey,
add key,
update key
About this parameter
Compute facet counts after deduplication (via the distinct setting).
If you’re using the distinct setting in combination with faceting,
facet counts may be higher than expected.
By default, Algolia computes facet counts before deduplicating records (distinct).
When facetingAfterDistinct is set to true, Algolia calculates facet counts after deduplicating.
-
facetingAfterDistinctapplies to all faceted attributes. To affect specific attributes, use theafterDistinctmodifier. -
To avoid inconsistent facet counts, don’t use
facetingAfterDistinctif you don’t have the same facet values in all records sharing the samedistinctkey. Use theafterDistinctattribute modifier instead. -
If
facetingAfterDistinctis set totrue, it takes precedence overafterDistinct. -
facetingAfterDistinctcan only be set at query time. You can’t add it as a default setting of the index.
Examples
Enable facetingAfterDistinct
1
2
3
$results = $index->search('query', [
'facetingAfterDistinct' => true
]);