问题
I have MySQL on shared hosting. Is there any way how to change value of ft_min_word_len
without administrator access?
I found one workaround, where every word that has less than 4 characters is supplemented with _ or some other char, and the same is done with every searched keyword that is less than 4 characters.
Is there any better, or cleaner way to make Fulltext search work for short words?
回答1:
Unfortunately, ft_min_word_len is a global system variable and cannot be set dynamically: see MySQL's online docs. Changing it would mean rebuilding every FULLTEXT
index around, btw, so you can see why they don't want non-admins to mess with it.
I fear your workaround (or something entirely equivalent) is the only way to solve the problem in your situation. Sorry! (But, compliments for thinking of it!).
回答2:
I know this is an old post but if someone has shell access to the server (even as non root) and mysql client tools you could do
myisamchk --recover --ft_min_word_len=2 mytable.MYI
Anyway you propably have to schedule this to run every day to include new values, too.
来源:https://stackoverflow.com/questions/1024456/can-i-change-ft-min-word-len-on-shared-hosting