tags:

views:

41

answers:

2

Hello,

I am using mysql match against query in my search query like this way

MATCH(film_name) AGAINST ('the vacation' IN BOOLEAN MODE).

But previously i use this one

film_name like '%the vacation%'

So my question is that i am getting the right result now by using match and against but the problem is that when i am using like there i can use the '%' sign before and after the search string so if the search string present with in the string then it was return the result so plz tell how to write my " MATCH(film_name) AGAINST ('the vacation' IN BOOLEAN MODE) " so that it also behaves `like '%'.

If the file name is 'rocketsingh'

then if i run film_name like '%rocket%' then it shows me the result

but if i run MATCH(film_name) AGAINST ('rocket' IN BOOLEAN MODE) then it will not showing me any result so plz suggest me what to do.

A: 

Hello,

The answer is: You can't. The MATCH AGAINST operator matches words, not strings. There is a difference between the two. Also note that your example will also match vacation, the, vacation the or the something something vacation and other. You should read here what searches you can do.

You should stick to your first option with LIKE if you don't want word searches.

Alin Purcaru
+2  A: 

MATCH command allows only prefixed wildcards but not postfixed wilcards. Since single words are indexed, a postfix wildcard is impossible to manage in the usual way index does. You can't retrieve *vacation instantly from index because left characters are the most important part of index.

Alpesh