setRanking method

AlgoliaSettings setRanking(
  1. List<String> value
)

Ranking (Ranking)

Controls how Algolia should sort your results.

You must specify a list of ranking criteria. Each criterion will be applied in sequence by the tie-breaking algorithm in the order they are specified.

Ranking Criteria:

  • typo: Sort by increasing number of typos.
  • geo: Sort by decreasing geo distance when performing a geo search. This criterion is ignored when not performing a geo search.
  • words: Sort by decreasing number of matched query words. This parameter is useful when you use the optionalWords query parameter to rank hits with the most matched words first.
  • filters: The filter criteria is the sum of scores for filters matched by one hit. In case of OR filters, only one score is taken in account even if the two filters match. This parameter must be present in the ranking if you want to use optionalFilters.
  • proximity: Sort by increasing proximity of query words in hits.
  • attribute: Sort according to the order of attributes defined by searchableAttributes.
  • exact: - If the query contains only one word: The behavior depends on the value of exactOnSingleWordQuery. - If the query contains multiple words: Sort by decreasing number of words that matched exactly.

Modifiers:

  • asc: Sort by increasing value of the attribute.
  • desc: Sort by decreasing value of the attribute.

Source: Learn more

Implementation

AlgoliaSettings setRanking(List<String> value) {
  assert(value.isNotEmpty, 'value can not be empty');
  assert(!_parameters.containsKey('ranking'));
  return _copyWithParameters(<String, dynamic>{'ranking': value});
}