我有一个像这样的查询
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)
但我无法得到想要的结果:匹配的单词越多,应该返回的分数越高。有任何想法吗?