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
Force faceting to be applied after de-duplication (via the Distinct setting).
When using the distinct
setting in combination with faceting,
facet counts may be higher than expected.
This is because the engine, by default, computes faceting before applying de-duplication (distinct
).
When facetingAfterDistinct
is set to true, the engine calculates faceting after the de-duplication has been applied.
Usage notes
-
You should not use
facetingAfterDistinct=true
if you don’t have the same facet values in all records sharing the same distinct key (you would get inconsistent results). -
facetingAfterDistinct
can only be set at query time; it can’t be added as a default setting of the index. -
The facet count is based on the number of hits the engine finds. This means that when using the
distinct
parameter to group results (with a numeric value greater than zero), the facet count isn’t based on the group itself, but on the hits that make up this group.
Examples
Enable facetingAfterDistinct
1
2
3
$results = $index->search('query', [
'facetingAfterDistinct' => true
]);