V
V
Vladimir2019-01-10 16:59:18
Sphinx
Vladimir, 2019-01-10 16:59:18

How to make a ranker?

Greetings.
There is a mysql table with records:

id artist          title
1  Валерий Меладзе Сэра 
2  Валерий Меладзе Сэра (слова Константина Меладзе)

Indexed by the query sql_query = select id, artist, title from base
For the query "valery meladze sir" through SphinxClient, the second record will be more relevant, since it has "Meladze" twice, but this is wrong. It is necessary that in the first place there are lines that more closely match the query (in this case, id=1 should be in the first place). At the same time, for the query "meladze", the first line should also be more relevant.
Tell me, please, how should a ranker solve such a problem look like?
Thanks in advance.
Sincerely.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2019-01-11
@iMaster

It's hard to say without the index config, but it seems to me that you have two text fields in the index - the artist and the title of the song. There is no exact match with any of them, but "common word sequences" ranks best with wlccs , and document length can be tracked using doc_word_count .
Those. the general idea is that the larger the common matching substring is, the better, plus we penalize for the length of the document.

OPTION ranker=expr('sum(wlccs*user_weight) * 100500 - doc_word_count * 42')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question