Skip to content

Commit f71f845

Browse files
clarify custom ranking rule usage
1 parent d40454e commit f71f845

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

learn/relevancy/custom_ranking_rules.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ description: Custom ranking rules promote certain documents over other search re
66

77
There are two types of ranking rules in Meilisearch: [built-in ranking rules](/learn/relevancy/ranking_rules) and custom ranking rules. This article describes the main aspects of using and configuring custom ranking rules.
88

9-
Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.
10-
119
## Ascending and descending sorting rules
1210

1311
Meilisearch supports two types of custom rules: one for ascending sort and one for descending sort.
@@ -22,6 +20,14 @@ To add a custom ranking rule, you have to communicate the attribute name followe
2220

2321
You can add this rule to the existing list of ranking rules using the [update settings endpoint](/reference/api/settings#update-settings) or [update ranking rules endpoint](/reference/api/settings#update-ranking-rules).
2422

23+
## How to use custom ranking rules
24+
25+
Custom ranking rules sort results in lexicographical order. For example, `Elena` will rank higher than `Ryu` and lower than `11` in a descending sort.
26+
27+
Since this operation does not take into consideration document relevancy, in the majority of cases you should place custom ranking rules after the built-in ranking rules. This ensures that results are first sorted by relevancy, and the lexicographical sorting takes place only when two or more documents share the same ranking score.
28+
29+
Setting a custom ranking role at a high position may result in a degraded search experience, since users will see documents in alphanumerical order instead of sorted by relevance.
30+
2531
## Example
2632

2733
Suppose you have a movie dataset. The documents contain the fields `release_date` with a timestamp as value, and `movie_ranking`, an integer that represents its ranking.

0 commit comments

Comments
 (0)