Patrick Patrick - 2 months ago 12
MySQL Question

MySQL: unexpected behaviour 'in boolean mode'

I use the following call for getting information from a database:

select *
from submissions
where
match( description ) against ('+snowboard' in boolean mode )
and (!disabled or disabled='n')
order by datelisted desc limit 30


Which means everything with ‘snowboard' in the description is found. Now here’s the problem:

select *
from submissions
where
match( description ) against ('+snowboard +mp4' in boolean mode )
and (!disabled or disabled='n')
order by datelisted desc limit 30


will ignore the +mp4 for some reason and return the same as the first query

select *
from submissions
where
match( description ) against ('+mp4' in boolean mode )


doesn't return anything, so basically it appears it's ignored in the search

Does anybody know how to work around this behavior?

Answer

mysql's boolean mode will only match words which are longer than a certain length. and mp4 is too short. you'd have to recompile mysql to change the threshold

EDIT: turns out, this can now be set via the config file, see http://dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html for furhter reference

Comments