用3个字母在全文搜索mysql [英] Fulltext search on mysql with a 3 letter word

查看:184
本文介绍了用3个字母在全文搜索mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  select url,name,
,MATCH(name)以B
,MATCH(name)AGAINST('>)作为A
,MATCH(名称)AGAINST(''zen *''BOOLEAN MODE) (名称)反对('cir *'在布尔模式中)作为C
,MATCH(名称)反对('thezen *'在BOOLEAN模式中)作为D
,MATCH作为E
,MATCH(姓名)反对('circus *'在BOOLEAN模式中)为F
,其中url ='thezencircus'

我得到了这个结果:

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

I 'b
$ b

有什么想法?

解决方案

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


[mysqld]

ft_min_word_len = 3

然后您必须重新启动服务器并重建您的FULLTEXT索引。 p>

记住重启和重建索引。



编辑

运行显示像'ft _%'这样的变量; 确认单词长度与您设置的内容相符。


I'm trying to find "the zen" string in a field containing "The Zen Circus". I've got a FULLTEXT index.

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'

I've got this result:

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

I've also putted ft_min_word_len = 2 in the msyql config file.

Any idea?

解决方案

See this answer MySQL full text search for words with three or less letters

[mysqld]
ft_min_word_len=3
Then you must restart the server and rebuild your FULLTEXT indexes.

Remeber to restart and rebuild indexes.


Edit
Run show variables like 'ft_%'; to confirm that the word length matches what you set it to.

这篇关于用3个字母在全文搜索mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆