Month: November 2011

MediaWiki search index with 3 letters acronyms.

Hi there,

Today I had to fix a ”feature” of MediaWiki using a MySQL DB.

The ”feature” in question is that we where not able to do search with only 3 letters word or acronyms. It indeed return result, but not all of them… It turn’s out that for performance reasons, MySQL an MediaWiki are set to index ”words” starting only with 4 caracters..

So, if you where searching for SSH, you would get result but not all of them. The fix is pretty easy when you know where to search… And I did search for a long time… lol

So, here is a step by step example to change that ”behaviour”

1-  Go to /etc/mysql or /etc and edit the my.cnf with vi or preferred editor…

2- Go to the [mysqld] section and add : ft_min_word_len=3

3- go to mysql command prompt by typing : mysql -p      or whatever will bring you MySQL server command line and choose the correct DB. You can type use db_bame; 

4- At the mysql command prompt, also type this : REPAIR TABLE searchindex QUICK;

5- restart or reload the MySQL DB(just to be sure)

6- go to the wiki folder (/var/www/wiki) or where it is on your server and edit LocalSettings.php config file and add : $wgDBminWordLen = 3;

7- Reload APACHE. /etc/init.d/apache2 reload

8- Rebuild mediawiki index like explained here : http://www.mediawiki.org/wiki/Manual:Rebuildtextindex.php

9- Have fun testing…

10- Leave a comment or question 🙂