MySQL Forums
Forum List  »  Full-Text Search

Re: Can I search against multiple keywords at once
Posted by: sricharan vemuri
Date: March 19, 2010 09:51AM

Hi all
After a little research I found out that if you want to search for multiple keywords you could just add space between each word. So if I want to perform a fulltext search on a table against words "apple, auto parts and apparel" then I would write it like this.

select * from tbl_name where match (col1, col2) AGAINST ('apple "auto parts" apparel' IN BOOLEAN MODE)

You might notice that I am using double quotes for word "auto parts", its because I want auto parts to be treated as single word. If I do not use double quotes it will treat auto and parts as two separate words since they are separated by spaces and the result will be any rows which has word auto or parts. But I wanted only the rows with the phrase "auto parts".

http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html

Please read the above article its pretty impressive.
You also might have noticed that I am using a Boolean mode search, the reason being in boolean mode supports double quotes where it treats the entity in double quotes as a single phrase.

Thank You
Charan

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Can I search against multiple keywords at once
9222
March 19, 2010 09:51AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.