mysql全文搜索不工作3个字符 [英] mysql full-text search not working for 3 characters

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

问题描述

在我的网站中,我已经使用全文搜索实现了搜索功能。

In my website I have implemented search feature using full-text search.

它通常工作正常,但有时不喜欢它给出结果,当我搜索关键字ship 但不是shi

It works fine usually but not sometimes like it gives results when I search with keyword "ship" but not "shi"

但它应该返回。请帮我解释为什么会发生这种情况。

But it should return. Please help me why this happening.

推荐答案

要索引的字的最小和最大长度由 ft_min_word_len ft_max_word_len 系统变量。默认最小值为 4 个字符。这是为什么它不能使用 3 个字符。

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.

您需要更改其值,并重建 FULLTEXT 索引。如果要三个字符的单词可搜索,可以通过更改其在配置文件中的值来设置 ft_min_word_len 变量。或者,如果您有超级用户权限,可以使用以下设置此环境变量:

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:

  SET  ft_min_word_len=3

在此处获取更多详细信息: 微调MySQL全文搜索

Get more details here: Fine-Tuning MySQL Full-Text Search

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

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