Jump to content

MATCH AGAINST (multiple columns)


slj90

Recommended Posts

I have a query that searches a single column

SELECT * FROM allmovies
        WHERE MATCH (all_title)
        AGAINST ('shrek' IN NATURAL LANGUAGE MODE);

However, I want to be able to search multiple columns

SELECT * FROM allmovies
        WHERE MATCH (all_title, all_tags, all_directors)
        AGAINST ('speilberg' IN NATURAL LANGUAGE MODE);

But that receives the error

#1191 - Can't find FULLTEXT index matching the column list

It works when searching each column individually, like above.

What is wrong with my query?

Thanks,

Link to comment
Share on other sites

The columns in the MATCH() must match the columns in the index definition.

You could either
 

...WHERE MATCH MATCH (all_title) AGAINST ('shrek' IN NATURAL LANGUAGE MODE) OR
         MATCH MATCH (all_tags) AGAINST ('shrek' IN NATURAL LANGUAGE MODE) OR
         MATCH MATCH (all_directors) AGAINST ('shrek' IN NATURAL LANGUAGE MODE) 

or

add a fulltext text index on (all_title, all_tags, all_directors)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.