Can't find FULLTEXT index matching the column list (indexes is set)

PhpMysqlFull Text-Search

Php Problem Overview


I'm working with fulltext, I executed an command to add the fulltext index to multiple comments, and returned no errors, then I did:

SELECT * FROM products WHERE MATCH(`brand`) AGAINST('Skoda');

Which is in the brand column - but I get following:

> Can't find FULLTEXT index matching the column list

Eventho, when my table looks like this:

FULLTEXT KEY `name` (`name`,`breadcrumb`,`description`,`brand`,`price`,`year`,`km`,`usage`,`type`)

Is it because I should use the name instead? to do the search? Or what can be wrong.

Php Solutions


Solution 1 - Php

Assuming you are using MyISAM engine, Execute:

ALTER TABLE products ADD FULLTEXT(brand);

The fulltext index should contain exactly the same number of columns, in same order as mentioned in MATCH clause.

Solution 2 - Php

If you don't feel like having the columns in the same order as in the match clause( or the same number), you can always use 'OR' that is:

ALTER TABLE products ADD FULLTEXT(brand);
ALTER TABLE products ADD FULLTEXT(product_name);

 SELECT * FROM products WHERE MATCH(brand) AGAINST('+Skoda*' IN BOOLEAN MODE) OR MATCH(product_name) AGAINST('+productName*' IN BOOLEAN MODE)

Solution 3 - Php

When everything was right and still got this error I found that the KEYS were disabled. A simple error that is sometimes overlooked:

Make sure you have enabled the keys on that table.

It didn't work for me when I had disabled the keys. But when I enabled the keys ALTER TABLE table name ENABLE KEYS; it worked fine

Solution 4 - Php

I found I also needed to do this on my instance as the index was not visible. It was a checkbox while exploring MySQL Workbench. While invisible the index is not reachable by a query.

ALTER TABLE products ALTER INDEX brand VISIBLE;

Solution 5 - Php

Make sure the table engine is set to MyISAM.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLucasRolffView Question on Stackoverflow
Solution 1 - PhpjerrymouseView Answer on Stackoverflow
Solution 2 - PhpChogoView Answer on Stackoverflow
Solution 3 - PhpkarthicView Answer on Stackoverflow
Solution 4 - Phpjorr-elView Answer on Stackoverflow
Solution 5 - PhpcodeafinView Answer on Stackoverflow