问题
I'm trying to run a very simple query on my MySQL INNODB table:
SELECT *
FROM items
WHERE MATCH (item_title,item_description) AGAINST ('dog')
Both column item_title
and item_description
have a FULLTEXT
index.
I keep getting this error:
Can't find FULLTEXT index matching the column list
My issue: when I query just item_title
or just item_description
then it works fine. But when I do both at once in 1 query, as shown above, I get that error.
Any idea what is wrong?
回答1:
You need a third index:
FULLTEXT(item_title, item_description)
回答2:
I might be late, just post here in case of someone get confuse :)
Run this query:
ALTER TABLE `items` ADD FULLTEXT(`item_title`,`item_description`);
Then you are able to run full-text search:
SELECT *
FROM items
WHERE MATCH (item_title,item_description) AGAINST ('dog')
回答3:
If you set full-text index for individual col that works. Say
ALTER TABLE `items` ADD FULLTEXT(`item_title`);
ALTER TABLE `items` ADD FULLTEXT(`item_description`);
回答4:
ALTER TABLE `table_name` ADD FULLTEXT (`item_title` ,`item_description`);
and then ( "SELECT table_name.*,
MATCH (item_title, item_description) AGAINST ('" . $search . "') AS relevance
FROM table_name
WHERE MATCH (item_title, item_description) AGAINST ('" . $search . "')
ORDER BY relevance DESC" );
来源:https://stackoverflow.com/questions/32200436/innodb-cant-find-fulltext-index-matching-the-column-list-when-queried-more-tha