In my website I have implemented search feature using full-text search.
在我的网站上,我使用全文搜索实现了搜索功能。
It works fine usually but not sometimes like it gives results when I search with keyword "ship" but not "shi"
它通常工作得很好,但有时不像我用关键字“ship”而不是“shi”搜索结果
But it should return. Please help me why this happening.
但它应该返回。请告诉我为什么会这样。
1 个解决方案
#1
8
The minimum and maximum lengths of words to be indexed are defined by the ft_min_word_len
and ft_max_word_len
system variables. The default minimum value is 4 characters. That is why it's not working with 3 characters.
索引单词的最小和最大长度由ft_min_word_len和ft_max_word_len系统变量定义。默认最小值是4个字符。这就是为什么它不能处理3个字符。
You need to change its value, and rebuild your FULLTEXT
indexes. If you want three-character words to be searchable, you can set the ft_min_word_len
variable by changing its value in the configuration file. Or, if you have super user permissions you can set this environment variable with:
您需要更改它的值,并重新构建您的全文索引。如果希望可以搜索三个字符的单词,可以通过更改配置文件中的值来设置ft_min_word_len变量。或者,如果您有超级用户权限,您可以将这个环境变量设置为:
SET ft_min_word_len=3
Get more details here: Fine-Tuning MySQL Full-Text Search
了解更多细节:微调MySQL全文搜索
#1
8
The minimum and maximum lengths of words to be indexed are defined by the ft_min_word_len
and ft_max_word_len
system variables. The default minimum value is 4 characters. That is why it's not working with 3 characters.
索引单词的最小和最大长度由ft_min_word_len和ft_max_word_len系统变量定义。默认最小值是4个字符。这就是为什么它不能处理3个字符。
You need to change its value, and rebuild your FULLTEXT
indexes. If you want three-character words to be searchable, you can set the ft_min_word_len
variable by changing its value in the configuration file. Or, if you have super user permissions you can set this environment variable with:
您需要更改它的值,并重新构建您的全文索引。如果希望可以搜索三个字符的单词,可以通过更改配置文件中的值来设置ft_min_word_len变量。或者,如果您有超级用户权限,您可以将这个环境变量设置为:
SET ft_min_word_len=3
Get more details here: Fine-Tuning MySQL Full-Text Search
了解更多细节:微调MySQL全文搜索