本文介绍了MySQL MATCH不能使用两个字符吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为"business"的表,其中包含以下示例数据:

I have a table called 'business' with the following sample data:

Street - 150 N Michigan Ave.
City - Chicago
State - IL
Zip - 60601

当我运行类似查询时

SELECT business.*
    WHERE MATCH(business.Street, business.City, business.State, business.Zip)
                AGAINST('*150*' IN BOOLEAN MODE)
-- IT WORKS


SELECT business.*
    WHERE MATCH(business.Street, business.City, business.State, business.Zip)
                AGAINST('*Chicago*' IN BOOLEAN MODE)
-- IT WORKS


SELECT business.*
    WHERE MATCH(business.Street, business.City, business.State, business.Zip)
                AGAINST('*60601*' IN BOOLEAN MODE)
-- IT WORKS


SELECT business.*
    WHERE MATCH(business.Street, business.City, business.State, business.Zip)
                AGAINST('*IL*' IN BOOLEAN MODE)
-- DOESNT WORK!!

那么上一次查询出了什么问题?

So what's wrong with the last query?

有什么想法吗?

推荐答案

更新my.cnf MySQL配置文件中的ft_min_word_len变量:

Update the ft_min_word_len variable in the my.cnf MySQL configuration file:

[mysqld]
ft_min_word_len=N

请注意,之后必须重建索引.

Note that afterwards indexes must be rebuilt.

这篇关于MySQL MATCH不能使用两个字符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 08:27