10

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?

TRiG
  • 10,148
  • 7
  • 57
  • 107
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327

2 Answers2

14

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!).

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
  • *If* you had administrator privileges: I haven't tested this, but if your data is static presumably you could set `ft_min_word_len = 1` temporarily, restart the server, build your database and index, and when you're done reset `ft_min_word_len` and restart again. Your database would then be left with the index you want? – Ken Sep 05 '11 at 08:57
  • I use xampp, how can I find `ft_min_word_len` ? – Shafizadeh Oct 13 '15 at 18:11
  • 1
    @Sajad, take a look at http://stackoverflow.com/questions/3706182/xampp-mysql-setting-ft-min-word-len – Alex Martelli Oct 17 '15 at 18:46
0

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.

Jürgen Steinblock
  • 30,746
  • 24
  • 119
  • 189