9

我试图在包含“The Zen Circus”的字段中找到“the zen”字符串。我有一个全文索引。

select url,name,
,   MATCH(name) AGAINST ( 'zen*' IN BOOLEAN MODE) as A
,   MATCH(name) AGAINST ( '"the zen*"' IN BOOLEAN MODE) as B
,   MATCH(name) AGAINST ('>the* zen' IN BOOLEAN MODE) as C
,   MATCH(name) AGAINST ('thezen*' IN BOOLEAN MODE) as D
,   MATCH(name) AGAINST ('cir*' IN BOOLEAN MODE) as E
,   MATCH(name) AGAINST ('circus*' IN BOOLEAN MODE) as F
from pages where url='thezencircus'

我得到了这个结果:

url = thezencircus
name = The Zen Circus
A = 0   (why?)
B = 0   (why?)
C = 0   (why?)
D = 0   (ok)
E = 1   (ok)
F = 1   (ok)

我还在 msyql 配置文件中加入了 ft_min_word_len = 2 。

任何的想法?

4

3 回答 3

10

查看这个答案MySQL全文搜索三个或更少字母的单词

[mysqld]
ft_min_word_len=3
然后你必须重新启动服务器并重建你的 FULLTEXT 索引。

请记住重新启动和重建索引。


编辑
运行show variables like 'ft_%';以确认字长与您设置的匹配。

于 2012-10-24T13:02:09.940 回答
2

Kao 是对的,但这对我一点帮助都没有——为什么?InnoDB 表使用不同的设置 - 尝试更新这个并检查它:

    show variables like 'innodb_ft_min_token_size';
于 2018-09-06T13:21:47.027 回答
0

SELECT *, MATCH (title) AGAINST('$aranan*' IN BOOLEAN MODE) AS score FROM vod WHERE MATCH (title) AGAINST ('$aranan*' IN BOOLEAN MODE) ORDER BY score DESC LIMIT 10

于 2022-01-05T16:11:38.460 回答