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,
GenerateSecuredApiKey,
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.
-
facetingAfterDistinct
applies to all faceted attributes. To affect specific attributes, use theafterDistinct
modifier. -
To avoid inconsistent facet counts, don’t use
facetingAfterDistinct
if you don’t have the same facet values in all records sharing the samedistinct
key. Use theafterDistinct
attribute modifier instead. -
If
facetingAfterDistinct
is set totrue
, it takes precedence overafterDistinct
. -
facetingAfterDistinct
can 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
]);