使用3个字母的单词在mysql上进行全文搜索

时间:2012-10-24 12:33:21

标签: mysql search full-text-search

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

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.

有什么想法吗?

2 个答案:

答案 0 :(得分:10)

请参阅此回答MySQL full text search for words with three or less letters

  

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

记住重新启动并重建索引。

<小时/> 的修改
运行show variables like 'ft_%';以确认字长与您设置的字长相匹配。

答案 1 :(得分:2)

Kao是对的,但这完全没有帮助我-为什么? InnoDB表使用不同的设置-尝试更新此设置并使用以下命令进行检查:

    show variables like 'innodb_ft_min_token_size';