• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Adjusting MySQL fulltext search

ChemicalKicks

Well-known member
#1
Running Ubuntu 10.04 LTS

I'm attempting to get a change show when searching for words on my forum, currently I am stuck on a limit of 4, would like it to be 3.

  • I changed the minimum work length limit in ACP > Search Options > 3
  • I went ahead and edited my.cnf by adding
    Code:
    [mysqld]ft_min_word_len=3
  • I restarted the mysql server then rebuilt search. Rebuild Caches > Rebuild Search Index > All

So in theory I should be able to search for say 'map', right? Searching for 3 letter words brings up nothing, I fear I'm missing a very obvious step :p

Thanks in advance.
 

ChemicalKicks

Well-known member
#3
Thanks for the heads up, I had read through both of those a couple of times though :)

I had made the file edit suggested even though I think it's now redundant, can someone confirm?

IDK what I'm missing at this stage, as a last resort I've done a full reboot and am rebuilding the search index again.
 

ChemicalKicks

Well-known member
#6
Cheers :)

I honestly don't know if this is the issue but yesterday when trying to sort this I did add in the additional option to my.cnf and it didn't change the result.

As far as I can tell even though the minimum word length is now 3 it's like the search indexes haven't rebuilt with the 3 letter count.
 

Jake Bunce

XenForo moderator
Staff member
#7
Try repairing your database using a program like phpmyadmin. Most of the tables are InnoDB which don't support repair, but the xf_search_index table is MyISAM which does. And I seem to remember that a repair is necessary to rebuild the index following the change you have made.

And make sure your search string doesn't contain a stop word:

http://dev.mysql.com/doc/refman/5.5/en/fulltext-stopwords.html

They are also listed in:

XenForo_Search_SourceHandler_MySqlFt
 

ChemicalKicks

Well-known member
#8
Hey Jake,

Thank you. I don't have phpmyadmin installed and I don't think I want to :D Would it be enough to repair the table (xf_search_index) from CLI then rebuild the search index again?
 

ChemicalKicks

Well-known member
#9
Right that worked.

For anyone else wanting to follow in my footsteps.

To repair "xf_search_index"

I issued the following commands in CLI

Code:
mysql > USE dbname;
mysql> REPAIR TABLE xf_search_index QUICK;