setFacetingAfterDistinct method
FacetingAfterDistinct
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.
Source: Learn more
Implementation
AlgoliaQuery setFacetingAfterDistinct({bool enable = true}) {
assert(!_parameters.containsKey('facetingAfterDistinct'));
return _copyWithParameters(
<String, dynamic>{'facetingAfterDistinct': enable});
}