setSortFacetValuesBy method
SortFacetValuesBy
Controls how facet values are sorted.
When using facets
, Algolia retrieves a list of matching facet values for each faceted attribute.
This parameter controls how the facet values are sorted within each faceted attribute.
Usage notes:
- You can either sort by
count
(the default, from high to low) oralphabetically
- The set of returned facet values depends on the maximum number of facet values returned, which
depends on the
maxValuesPerFacet
setting. The default is 100 and the max is 1000. Therefore, values with very low frequency could potentially not be returned.
Options:
- count: Facet values are sorted by decreasing count. The count is the number of records containing this facet value in the results of the query.
- alpha: Facet values are sorted in alphabetical order, ascending from A to Z. The count is the number of records containing this facet value in the results of the query.
Source: Learn more
Implementation
AlgoliaQuery setSortFacetValuesBy(AlgoliaSortFacetValuesBy value) {
assert(!_parameters.containsKey('sortFacetValuesBy'));
return _copyWithParameters(<String, dynamic>{
'sortFacetValuesBy':
value.toString().substring(value.toString().indexOf('.') + 1)
});
}