How can I enable full-text index in Mysql?
How can I enable full-text index in Mysql?
In general, the like Statement of SQL is used for database search, and the like statement cannot use indexes. Each query goes from the first to the last one, and the query efficiency is extremely low. Generally, if the data exceeds 0.1 million or the number of online users is too large, like queries may cause database crashes. This is why many programs only provide title search, because if the content is searched, it will be slower and tens of thousands of data will not run.
Mysql full-text index is designed to solve fuzzy queries. You can index the entire article by words in advance, which is highly efficient in search and supports retrieval of millions of data records.
Full-text indexing is supported since Mysql 4.0, but the default minimum index length of Mysql is 4. If the default value of English is reasonable, but most Chinese words are 2 characters, the words with less than 4 words cannot be indexed, and the full-text index function is also false. Most domestic space vendors may not have noticed this problem and have not modified the default settings of Mysql.
If you are using your own server, set it immediately. Do not waste this function.
If you are using a virtual host, please immediately contact the Space Provider to modify the configuration. First, this default value of Mysql is an incorrect setting for Chinese characters. The modification is equal to correct the error. Second, the configuration modification is very simple, that is, a few minutes, and the improved search efficiency also reduces the chance of the Space Provider database downtime. If you send this article to the space service provider, I believe most of them will be willing to change.
Setting method:
Contact the server administrator to modify my. ini, add a line "ft_min_word_len = 1" after [mysqld], restart Mysql, and then log on to the website background (module management-> full-Site Search) to recreate the full-text index, otherwise, you cannot use the full-site search function.