1

I am trying to search my table for some mobile phones and am trying to get the results via Full-text search. My query is:

SELECT id,itemid,title,MATCH(title) AGAINST 
    ("SAMSUNG GALAXY S3" IN NATURAL LANGUAGE MODE) as score 
    FROM `deals`WHERE MATCH(title) AGAINST 
    ("SAMSUNG GALAXY S3" IN NATURAL LANGUAGE MODE) ORDER BY score desc;

The results i get are shown in the image below:

Search Result

What i expect is the second result to come up on top as it is the exact match, but it doesn't. Can somebody please correct me on what i might be doing wrong here.

Thanks.

Edit Results in boolean mode Results in boolean mode

2

1 Answer 1

1

I'm afraid "S3" is too short token to be considered to be a word by the full text search. See relevant section of the docs (the default minimum word length is 4 characters) http://dev.mysql.com/doc/refman//5.5/en/server-system-variables.html#sysvar_ft_min_word_len

EDIT you can verify this by searching for e.g.:

"SAMSUNG GALAXY S360"
3
  • Yes, when i search for something like "Samsung Galaxy SIII", it works. Thanks a ton for helping me. Seems i need to find a way to address these kind of searches. Thanks a lot!
    – web-nomad
    Commented Jun 18, 2012 at 10:55
  • I think you can set 2 in ft_min_word_len, that should work for ""SAMSUNG GALAXY S3"
    – bpgergo
    Commented Jun 18, 2012 at 10:58
  • In that case i will have to rebuild the index, will check if this helps.
    – web-nomad
    Commented Jun 18, 2012 at 11:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.