API Reference / API Parameters / facetingAfterDistinct
Feb. 26, 2019

facetingAfterDistinct

Type: boolean
Engine default: false
Parameter syntax
'facetingAfterDistinct' => true|false

Can be used in these methods:

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.

  • facetingAfterDistinct will be ignored if you also set typoTolerance to either strict or min.

Examples

Enable facetingAfterDistinct

1
2
3
$results = $index->search('query', [
  'facetingAfterDistinct' => true
]);

Did you find this page helpful?