gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 06:29:12 28 4
gpt4 key购买 nike

我正在尝试在包含“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。

有什么想法吗?

最佳答案

查看此答案 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.

记得重启并重建索引。


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

关于mysql - 使用 3 个字母的单词在 mysql 上进行全文搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13049306/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com