MySQL MATCH AGAINST:即使几个单词匹配,相同的分数?

时间:2017-01-12 13:48:32

标签: mysql scoring match-against

我有一个像

这样的查询
SELECT SQL_CALC_FOUND_ROWS ap.id, ap.name,
MATCH(t.uri_slug) AGAINST('"tomatoe"') AS tag_score,
MATCH(ap.name) AGAINST('blue tomatoe' IN BOOLEAN MODE) AS name_score
FROM [...]
GROUP BY ap.id
ORDER BY (tag_score + name_score) DESC, tag_score DESC, name_score DESC
LIMIT 10

此给定查询的结果是:

id      | name                  | tag_score                 | name_score
--------|-----------------------|---------------------------|------------------
11622   | Holy Tomatoe          | 11.033016204833984        | 7.384857654571533
26996   | Tomatoe Max           | 11.033016204833984        | 7.384857654571533
14116   | Newblue-Tomatoe       | 11.033016204833984        | 7.384857654571533
38402   | Monster-Jam           | 11.033016204833984        | 0
...

如您所见,id为14116的行在ap.name中包含单词blue和tomatoe。即使两个单词匹配,分数也是相同的,就像一个单词匹配一样。所以我尝试了AGAINST('+style +mode' IN BOOLEAN MODE)AGAINST('+*style* +*mode*' IN BOOLEAN MODE),但我无法得到理想的结果:匹配的字数越多,就应该返回更高的分数。有什么想法吗?

0 个答案:

没有答案