我喜欢按相关性对BOOLEAN
通配符搜索进行排序。作为BOOLEAN
has only a binary score,我们需要使用NATURAL
模式来获得体重评分。但NATURAL
不支持运算符,因此它不会返回任何结果(得分= 0):
mysql>SELECT
topic_id,
MATCH(topic_text) AGAINST('tunin') AS score
FROM
topics_search
WHERE
MATCH(topic_text) AGAINST('tunin*' IN BOOLEAN MODE)
ORDER BY
score DESC
LIMIT 10
+----------+----------+
| topic_id | score |
+----------+----------+
| 2 | 0 |
| 6 | 0 |
| 16 | 0 |
| 17 | 0 |
| 18 | 0 |
| 24 | 0 |
| 26 | 0 |
| 27 | 0 |
| 31 | 0 |
| 32 | 0 |
+----------+----------+
10 rows in set (202 ms)
我可以使用LIKE '%tunin%'
,但这不会给我一个分数。
问题
是否有可能获得通过通配符搜索命中的全文索引的所有单词?
示例:
mysql>SELECT
fulltext_index_words
FROM
topics_search
WHERE
MATCH(topic_text) AGAINST('tunin*' IN BOOLEAN MODE)
+----------------------+
| fulltext_index_words |
+----------------------+
| tuning |
| tunings |
+----------------------+
2 rows in set (1 ms)