Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL MATCH doesn't work with two characters?

Tags:

mysql

match

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

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

When I run a query like

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?

Any ideas?

like image 263
Raihan Iqbal Avatar asked Aug 01 '10 10:08

Raihan Iqbal


3 Answers

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.

like image 125
the_void Avatar answered Nov 05 '22 03:11

the_void


Fulltext search stop some common word, but it is disable using this steps.

1: open my.ini file in MYSQL configuration file.

2: place ft_min_word_len=1 line after [mysqld] line in my.ini

[mysqld]
ft_min_word_len=1

3: restart your server

4: repair your table using below command

repair table tablename;

5: now your search is working....

like image 3
Kishan Vadaliya Avatar answered Nov 05 '22 02:11

Kishan Vadaliya


Looks like you're running into the minimum length limit, as stated in the MySQL docs.

like image 1
Will A Avatar answered Nov 05 '22 04:11

Will A