Reputation: 33
I have a problem with MATCH AGAINST, when i'm trying to find a record. In my users table i have a user with the following data:
first_name: Alejandra Maria de los Angeles last_name: Quintero Barreiro Gutierrez
when i try to make the following queries:
SELECT *
FROM articles
INNER JOIN users ON articles.author_id = users.id
WHERE MATCH(first_name,last_name) AGAINST('Alejanra Gutierrez')
SELECT *
FROM articles
INNER JOIN users ON articles.author_id = users.id
WHERE MATCH(first_name,last_name) AGAINST('A Barreiro')
SELECT *
FROM articles
INNER JOIN users ON articles.author_id = users.id
WHERE MATCH(first_name,last_name) AGAINST('los angeles')
All queries are returning correct information, but if the search is replace for "de los" which is in the first_name, the query doesn't work.
Someone have some idea why or can help me with this?
P.D. The tables were in InooDB with MySQL 5.6.15 but i changed it by MyISAM. When i had InooDB this kind of queries was working but with the engine change doesn't work
Upvotes: 2
Views: 93
Reputation: 1269445
MySQL full text search ignores words shorter than 4 characters by default. Read about it here:
The minimum and maximum lengths of words to be indexed are defined by the innodb_ft_min_token_size and innodb_ft_max_token_size for InnoDB search indexes, and ft_min_word_len and ft_max_word_len for MyISAM ones. After changing any of these options, rebuild your FULLTEXT indexes for the change to take effect. For example, to make two-character words searchable, you could put the following lines in an option file
(Okay, that reference doesn't specify that the default is "4", but it is.)
Follow the instructions: change the default and rebuild the index.
Upvotes: 1