How to change mysql variable of ft_min_word_len?


#1

I’m a dreamhost user with host imfido.com. I need to search Chinese in my website, and need to set ft_min_word_len=1. But, how could I set the variable?


#2

If you need to search Chinese characters in your database, you need to set proper collation (UTF-8, etc) when you create your tables. I don’t think it has anything to do with ft_min_word_len.


#3

As you know, unlike English words, Chinese words are separated letters. So, changing this variable is necessary. If you want to know more, just read how WordPress (or some other search tools using mysql) process these kind of search (He changes the value of variable ft_min_word_len). Google will help.


#4

Hmm… That is interesting.

Unfortunately MySQL is hosted on separate shared servers that you will not have access to.


#5

Yes… It’s terrible, which may mean that I have to write the search engine myself…


#6

We can change variables like that for you if you’re on a private MySQL server. I can’t guarantee that this change will make Chinese search work, though — by default, I believe MySQL will end up treating a Chinese sentence as a single “word” (since there are no spaces in it!).


#7

MySQL will not treat Chinese sentence as a single word if the collation is set up correctly. For example: if you are using UTF-8, each Chinese character will be encoded and stored as a single character. To me, ft_min_word_len is redundant.