Fix wiki search

From PTAGISWiki

Jump to: navigation, search


Reference this document for more details: http://dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html

By default, mysql doesn't allow searching for words less than 4 letters. There are a lot of 3-letter acronyms that we would like to search for.

  • modify /usr/local/mysql/my.cnf
[mysqld]
set-variable = ft_min_word_len=3
  • restart mysql
  • verify the configuration change was made
mysql> show variables like 'ft_%';
+--------------------------+----------------+
| Variable_name            | Value          |
+--------------------------+----------------+
| ft_boolean_syntax        | + -><()~*:""&| | 
| ft_max_word_len          | 84             | 
| ft_min_word_len          | 3              | 
| ft_query_expansion_limit | 20             | 
| ft_stopword_file         | (built-in)     | 
+--------------------------+----------------+
5 rows in set (0.01 sec)
  • rebuild the search index table:
bash-3.00# mysql ptagiswiki
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 34 to server version: 5.0.24

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> repair table mw_searchindex quick;
+---------------------------+--------+----------+----------+
| Table                     | Op     | Msg_type | Msg_text |
+---------------------------+--------+----------+----------+
| ptagiswiki.mw_searchindex | repair | status   | OK       | 
+---------------------------+--------+----------+----------+
1 row in set (12.06 sec)
Personal tools