V
V
Vyacheslav Shevchenko2020-12-22 20:02:37
Sphinx
Vyacheslav Shevchenko, 2020-12-22 20:02:37

How does the BM25 ranker work in sphinx?

There are three documents with a title field: a blue sofa, a red sofa, and a green sofa. Do a search for the word "sofa".

SELECT item, weight() AS rank FROM test WHERE match('@(title) диван') ORDER BY rank DESC OPTION ranker = BM25;

We get the result with all three documents and a weight of 1319. Where does 1319 come from? Can someone paint in numbers how it turned out exactly 1319?

https://habr.com/ru/company/sphinx/blog/62287/ - it says here that bm25 is a real number in the range from 0 to 1. Again, where does 1319 come from then?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
ManticoreSearch, 2020-12-23
@WebDev2030

1. The value of the weight of the found document is multiplied by 1000 and rounded off (0.319*, for example, becomes 319)
2. `ranker = BM25` takes into account the weight of the fields in fact. By default, each field has 1, but it is also multiplied by 1000.
3. Both numbers are summed up, it turns out: 1000*1 + 0.319*1000 = 1319

P
Puma Thailand, 2020-12-23
@opium

read the doc there everything is described in some detail and you can immediately understand where more than 1000 values ​​come from
sphinxsearch.com/docs/current/formulas-for-builtin...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question