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

Implemented Addition of a MySQL FULLTEXT 'minWordLength' setting in the admin.

TimWF

Active member
#1
As detailed in:

http://xenforo.com/community/threads/xf-search-engine.1143/#post-145893

The variable that sets the minimum word length for a search is set in the library/XenForo/Search/SourceHandler/MySqlFt.php (line 20) file. If you have a min other than 4 you can just edit this file accordingly to change the setting, but then of course when you upgrade your forum software that file can be overwritten, changing it back to the default 4.

It would be great to have a way to set this in the admin area or something like that, just somewhere that isn't going to be overwritten upon upgrade. Thanks!
 
#2
Don't forget, that this option in MySQL is set only in the my.cnf config file (cannot be set on-the-fly) and if you change it in MySQL, you need to rebuild all indexes to have this in effect.
 

TimWF

Active member
#3
No doubt, perhaps it would be helpful to have that same information right next to this setting as well. I could see that someone that just ran into the setting could easily think that all they had to do was change it in the Xenforo back end otherwise.
 

dvsDave

Well-known member
#6
I would prefer if I could create an exception list. A list of terms that are 3 characters or less that I wanted the search engine to index. Here's my current list from my still-production vB install.

I run a technical theatre site and there are a LOT of 2 and 3 letter acronyms that the industry uses:

php iso fx led diy wtf ink sfx dmx gel par xlr amx fog thx vmf am fm vr pro con dvd vhs amd rf akg ev qvc rca mgm drm fcc vga rgb cmy rta trs ts ers hid ea mcm acn rf af amp cue dBV dBU SPL hz htz gig PL BTN BTR BTL FEL 02R EOS ION XL8 pit bar fly TD ATD LD ALD SM ASM ME AME RDM PIN IEM AFL PFL AC DC AWG SOW dry ice S4 EQ
 

Tigratrus

Well-known member
#7
I would prefer if I could create an exception list. A list of terms that are 3 characters or less that I wanted the search engine to index. Here's my current list from my still-production vB install.

I run a technical theatre site and there are a LOT of 2 and 3 letter acronyms that the industry uses:
That is an excellent idea. It would cut down on the overhead of the index SUBSTANTIALLY, and most nice community admins have (or can come up with) a list of 2 or three letter abbreviations that their community uses.

Just search here (or... Heck on vb.com!) for any terms like RSS, CSS, SQL, CDN etc. etc.

Clearly it's a common need. :)
 

Dean

Well-known member
#8
Is there any progress on this?

I need to keep changing this variable $_minWordLength = 3; after every upgrade. And of course when I run the new admincp -> Tools -> File Health Check it fails on that file.
library/XenForo/Search/SourceHandler/MySqlFt.php

Just moving it to config.php would be fantastic. :)
 

Marcus

Well-known member
#9
1. Either give us the option to enter a minimum lenght for mysql words or - better -
2. fetch this value from my.cnf and use it

Some posts from http://xenforo.com/community/threads/xf-search-engine.1143/
As mlx posted above, you would need to change the MySQL configuration file:
The minimum and maximum lengths of words to be indexed are defined by the ft_min_word_len andft_max_word_len system variables. (See Section 5.1.3, “Server System Variables”.) The default minimum value is four characters; the default maximum is version dependent. If you change either value, you must rebuild yourFULLTEXT indexes. For example, if you want three-character words to be searchable, you can set theft_min_word_len variable by putting the following lines in an option file:
[mysqld]
ft_min_word_len=3
http://dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html
Looks like there's a minimum word length setting in library/XenForo/Search/SourceHandler/MySqlFt.php (line 20). That should be pulled from an option I think.
 

Brogan

XenForo moderator
Staff member
#10
1.1.0 Beta 3 now has the option to set a minimum word length.

Search Minimum Word Length
This is the minimum length of a word that can be searched by the index. With the default search system, this should correspond with the MySQL full text minimum word length (normally 4).