- Type:
list<string> - Default:
["typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] - Scope:
settings
Usage
- Attribute names are case-sensitive.
- Add
asc(attribute)ordesc(attribute)to the list to sort by attributes such aspriceorpopularity. - 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).
Examples
Use the default ranking
Current API clients
Current API clients
Legacy API clients
Legacy API clients
Sort by ascending price
Current API clients
Current API clients
Legacy API clients
Legacy API clients