Re: why does MATCH/AGAINST fail to catch entries that LIKE does catch?



lawrence k wrote:


Wierd. Go to this page:

http://www.ihanuman.com/search.php

and search for "yoga"

This query gets run:

SELECT * FROM albums WHERE MATCH(name,description) AGAINST ('yoga')
ORDER BY id DESC

it returns nothing. (other searches work, but not the one for
"yoga").

But if I do SELECT * FROM albums WHERE description LIKE '%yoga%'

then I get 5 matches

What the hell??

Hi,

You are talking about MySQL I guess.
My knowledge of MySQL is limitted, but I think I can answer your question
based on TSEARCH2 as found in Postgresql.
Maybe it helps.

When you use 'match against' you are performing a full text search, which is
conceptually something different than LIKE '%yoga%'.

eg:
holayogatralala will match with: LIKE '%yoga%'
but not in match against.

FULL TEXT INDEXING is using whole words (or derivates) from a word.
This process is called 'stemming'.
eg: 'use' , 'used', and 'using' can all be stemmed to 'use'.
I *think* 'use' is called lexicon in this context, not 100% sure though..

Hope that helps.

Regards,
Erwin Moller
.



Relevant Pages