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
Apply faceting after deduplication (via the distinct setting).
If you want to use faceting in combination with deduplication or grouping (distinct
),
you should use the afterDistinct
modifier in your attributesForFaceting
.
This only affects a single attribute. facetingAfterDistinct
affects all attributes.
If you’re using the distinct
setting in combination with faceting,
facet counts may be higher than expected.
By default, Algolia computes faceting before deduplicating records (distinct
).
When facetingAfterDistinct
is set to true, Algolia calculates faceting after deduplicating.
Usage notes
- To avoid inconsistent results when the records sharing the same distinct key don’t have the same facet values,
use the
afterDistinct
- If you have the same facet values in all records sharing the same distinct key,
you can use
facetingAfterDistinct=true
. 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
]);