0

I would like to have a search engine using PHP and MySQL to perform searches like this:

I will search for bumblebee camaro, in about 3 fields in tables.

I want to have results that return rows with both texts (having bumblebee and camaro) and also return the same result if I search for bumblebee cam.

I was using MATCH AGAINST IN BOOLEAN MODE, but the result was record with bumblebee, record with bumblebee and camaro.

I don't want records with only bumblebee text, only the second one. How to do that?

My SQL was: MATCH (field1,field2,field3) AGAINST('+bumblebee cam' IN BOOLEAN MODE)

Thanks for the response in advance!

Btw, I did try to split the keyword, but it was not returning the correct answer, because somehow the word bumblebee from the field1, and camaro from the field2, if i split it. it will show record the one that i dont need

1 Answer 1

1
MATCH (field1,field2,field3) AGAINST ('bumblebee cam' IN BOOLEAN MODE)

would search for one of the words

MATCH (field1,field2,field3) AGAINST ('+bumblebee +cam' IN BOOLEAN MODE)

would search both words

MATCH (field1,field2,field3) AGAINST ('-bumblebee  +cam' IN BOOLEAN MODE)

would search Term without Search

just split the words and build it with using + - | , whatever needed.

check documentation on : http://dev.mysql.com/doc/refman/5.5/en/fulltext-boolean.html

Sign up to request clarification or add additional context in comments.

1 Comment

Btw, I did try to split the keyword, but it was not returning the correct answer, because somehow the word bumblebee from the field1, and camaro from the field2, if i split it. it will show record the one that i dont need

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.