- Type:
list<string>
- Default:
["typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"]
- Scope:
settings
You can change the order of the default criteria but you shouldn’t.
The out-of-the-box ranking order works for most uses.
Before changing this parameter, consider running an A/B test to ensure your changes will positively affect results.
Usage
- Attribute names are case-sensitive.
- Add
asc(attribute)
ordesc(attribute)
to the list to sort by attributes such asprice
orpopularity
. - You can reorder or remove criteria to fine-tune ranking, but the default order works well for most situations.
- Ranking also depends on the order of attributes in
searchableAttributes
.
Ranking criteria
typo
Rank results by the fewest spelling mistakes.
geo
Rank results by increasing distance.
This option only applies when performing a geographical search.
words
Rank results by the number of matching query words, starting with the most matches.
Only applies when using
optionalWords
.filters
Rank results by filter score.
This option is essential when using
optionalFilters
.proximity
Rank results by how close the query words are to each other in the record.
attribute
Rank results based on the order of attributes defined in
searchableAttributes
.exact
For single-word queries, follows the behavior defined by the
exactOnSingleWordQuery
setting.
For multi-word queries, ranks by number of exact word matches.custom
Rank results based on the values of attributes listed in
customRanking
.
If not included in ranking
, the custom ranking criterion is ignored.Modifiers
asc
Sort in ascending order (lowest to highest).
desc
Sort in descending order (highest to lowest).