views:

35

answers:

1

I am using fulltext searching in mysql to search a database of videos I have, however when I search my videos some results will never get returned because the title I am searching for is less than the ft_min_word_len set in MySQL's settings.

mysql_query("SELECT MATCH(videoDescription) AGAINST('".$searchString."' IN NATURAL LANGUAGE MODE) 
               FROM videos 
              LIMIT ".$start.",".$end."");

I tried firing up the mysql console to change the setting, however it told me it is read only. The only possible solution I have seen is to have the setting overridden at startup with option files. How do I use option files to overwrite the ft_min_word_len to 2 at startup?

+4  A: 

ft_min_word_len is a system variable, that has to be set at the startup of the MySQL server.

This can be done passing parameters on the command-line used to start MySQL, or (recommended, I'd say), using a file containing options -- generally, for example, something like /etc/my.cnf or /etc/mysql/my.cnf should do the trick.


For more informations about setting system variables, you can take a look at the following section of the manual :


Also, don't forget that you'll have to rebuild your fulltext index, after changing that parameter, so the new value is taken into account.

Pascal MARTIN
Thanks, I know about having to rebuild the fulltext index. The documentation just looked a little thick to me, do I simply edit my.cnf and add the line ft_min_word_len = 2?http://dev.mysql.com/doc/refman/5.1/en/option-files.html
AFK
If anything I'm not sure which [group] this option falls under.
AFK
`[mysqld]`. `2` is a bit ambitious!
bobince
@AFK : considering it's related to the server, I would place it in a `[mysqld]` section ; that's also what's done in the example given on http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html
Pascal MARTIN