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.
To test this functionality on your Algolia dashboard and to get the correct results in both facets and hit results, you would need to set the facetingAfterDistinct
parameter to true. You can do that by selecting "Add Query Paramater" on your Algolia dashboard and passing the facetingAfterDistinct
parameter to custom search parameters.
Keep in mind, facetingAfterDistinct
can only be set at query time; it can’t be added as a default setting of the index. You can set this setting at query time when the request is made on your website.
If you're still getting inconsistent facet counts with facetingAfterDistinct
set to true, please review this guide here.