I’m trying to costumized proximity_bm25 . It works perfectly fine with payloads when I do this search:
SELECT id, weight() FROM index WHERE MATCH(‘query’)
I’m trying to costumize the ranker formula so I need to use:
OPTION ranker=expr(‘sum(lcs*user_weight)+bm25’)
However, results are different. I’m using payloads with this content:
As stated in the manual the default ranker is sum(lcs*user_weight)*1000+bm25, then the weights do not differ:
mysql> select *, weight() from t where match('a') option ranker=expr('sum(lcs*user_weight)*1000+bm25');
+---------------------+------+----------+
| id | f | weight() |
+---------------------+------+----------+
| 1514212650895016040 | a | 1356 |
| 1514212650895016041 | a a | 1302 |
+---------------------+------+----------+
2 rows in set (0.01 sec)
mysql> select *, weight() from t where match('a');
+---------------------+------+----------+
| id | f | weight() |
+---------------------+------+----------+
| 1514212650895016040 | a | 1356 |
| 1514212650895016041 | a a | 1302 |
+---------------------+------+----------+
2 rows in set (0.01 sec)
field_weights also works fine to me:
mysql> select *, weight() from t where match('a') option field_weights=(f=10);
+---------------------+------+----------+
| id | f | weight() |
+---------------------+------+----------+
| 1514212650895016040 | a | 10356 |
| 1514212650895016041 | a a | 10302 |
+---------------------+------+----------+
2 rows in set (0.00 sec)
mysql> select *, weight() from t where match('a') option ranker=expr('sum(lcs*user_weight)*1000+bm25'), field_weights=(f=10);
+---------------------+------+----------+
| id | f | weight() |
+---------------------+------+----------+
| 1514212650895016040 | a | 10356 |
| 1514212650895016041 | a a | 10302 |
+---------------------+------+----------+
2 rows in set (0.01 sec)
Yes, I tried downloading 3.5.4. But results are similar.
It looks like that the problem is using payload with a custom rank. I can’t reproduce the same result. If I don’t use payloads results are similar, however, I am interested in mix payloads with a custom rank to get better results in my use case.