You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/develop/ai/search-and-query/administration/overview.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,9 +239,23 @@ These are the pre-bundled scoring functions available in Redis:
239
239
*
240
240
Identical to the default TFIDF scorer, with one important distinction:
241
241
242
-
***BM25**
242
+
***BM25STD (default)**
243
243
244
-
A variation on the basic TF-IDF scorer. See [this Wikipedia article for more information](https://en.wikipedia.org/wiki/Okapi_BM25).
244
+
A variation on the basic `TFIDF` scorer (see [this Wikipedia article for more information](https://en.wikipedia.org/wiki/Okapi_BM25)).
245
+
246
+
The relevance score for each document is multiplied by the presumptive document score and a penalty is applied based on slop as in `TFIDF`.
247
+
248
+
{{< note >}}
249
+
The `BM25` scorer was renamed `BM25STD` in Redis Open Source 8.4. `BM25` is deprecated.
250
+
{{< /note >}}
251
+
252
+
***BM25STD.NORM**
253
+
254
+
A variation of `BM25STD`, where the scores are normalized by the minimum and maximum score.
255
+
256
+
***BM25STD.TANH**
257
+
258
+
A variation of `BM25STD.NORM`, where the scores are normalised by the linear function `tanh(x)`. `BMSTDSTD.TANH` can take an optional argument, `BM25STD_TANH_FACTOR Y`, which is used to smooth the function and the score values. The default value for `Y` is 4.
Copy file name to clipboardExpand all lines: content/develop/ai/search-and-query/advanced-concepts/scoring.md
+25-3Lines changed: 25 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ weight: 8
19
19
20
20
When searching, documents are scored based on their relevance to the query. The score is a floating point number between 0.0 and 1.0, where 1.0 is the highest score. The score is returned as part of the search results and can be used to sort the results.
21
21
22
-
Redis Open Source comes with a few very basic scoring functions to evaluate document relevance. They are all based on document scores and term frequency. This is regardless of the ability to use [sortable fields]({{< relref "/develop/ai/search-and-query/advanced-concepts/sorting" >}}). Scoring functions are specified by adding the `SCORER {scorer_name}` argument to a search query.
22
+
Redis Open Source comes with a few scoring functions to evaluate document relevance. They are all based on document scores and term frequency. This is distinct from the ability to use [sortable fields]({{< relref "/develop/ai/search-and-query/advanced-concepts/sorting" >}}). Scoring functions are specified by adding the `SCORER {scorer_name}` argument to a search query.
23
23
24
24
If you prefer a custom scoring function, it is possible to add more functions using the [extension API]({{< relref "/develop/ai/search-and-query/administration/extensions" >}}).
25
25
@@ -78,14 +78,36 @@ Term frequencies are normalized by the length of the document, expressed as the
78
78
FT.SEARCH myIndex "foo" SCORER TFIDF.DOCNORM
79
79
```
80
80
81
-
## BM25 (default)
81
+
## BM25STD (default)
82
82
83
83
A variation on the basic `TFIDF` scorer, see [this Wikipedia article for more info](https://en.wikipedia.org/wiki/Okapi_BM25).
84
84
85
85
The relevance score for each document is multiplied by the presumptive document score and a penalty is applied based on slop as in `TFIDF`.
86
86
87
+
{{< note >}}
88
+
The `BM25` scorer was renamed `BM25STD` in Redis Open Source 8.4. `BM25` is deprecated.
89
+
{{< /note >}}
90
+
91
+
```
92
+
FT.SEARCH myIndex "foo" SCORER BM25STD
93
+
```
94
+
95
+
## BM25STD.NORM
96
+
97
+
A variation of `BM25STD`, where the scores are normalized by the minimum and maximum scores.
98
+
99
+
`BM25STD.NORM` uses min–max normalization across the collection, making it more accurate in distinguishing documents when term frequency distributions vary significantly. Because it depends on global statistics, results adapt better to collection-specific characteristics, but this comes at a performance cost: min and max values must be computed and updated whenever the collection changes. This method is recommended when ranking precision is critical and the dataset is relatively stable.
100
+
101
+
## BM25STD.TANH
102
+
103
+
A variation of `BM25STD.NORM`, where the scores are normalised by the linear function `tanh(x)`. `BMSTDSTD.TANH` can take an optional argument, `BM25STD_TANH_FACTOR Y`, which is used to smooth the function and the score values. The default value for `Y` is 4.
104
+
105
+
`BM25STD.TANH` applies a smooth transformation using the `tanh(x/factor)` function, which avoids collection-dependent statistics and yields faster, more efficient scoring. While this makes it more scalable and consistent across different datasets, the trade-off is reduced accuracy in cases where min–max normalization provides sharper separation. This method is recommended when performance and throughput are prioritized over fine-grained ranking sensitivity.
106
+
107
+
Following is an example of how to use `BM25STD_TANH_FACTOR Y` in a query.
0 commit comments