Innodb: Can't find FULLTEXT index matching the column list when queried more than 1 columns

岁酱吖の 提交于 2020-07-18 04:19:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!