Bootstrap FreeKB - mySQL / MariaDB - Fulltext stop words
mySQL / MariaDB - Fulltext stop words

Updated:   |  mySQL / MariaDB articles

With a MyISAM fulltext index, there are certain stop words that will not be used in a search. For example, the words right, second, and seeing are stop words, meaning that search will not produce any results with these stop words.  Click here for a list of common stop words. Make a file that contains your preferred stop words, and add the file to the /var/www/ directory on your server. If the file that contains the stop words is named stopwords, you would add the following to your /etc/my.cnf file.

ft_stopword_file = /var/www/stopwords

 

The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.

If your system is using systemd, use the systemctl command to restart MariaDB.

systemctl restart mariadb
systemctl status mariadb

 

If your system is using init, use the service command to restart MariaDB.

service mariadb restart
service mariadb status

 

Type mysql -u root -p and press enter to connect to MariaDB.

~]# mysql -u root -p
Enter password:

 

Repair your fulltext index table.

repair table table_name quick

|---------------------------------------------------------|
| Table                    | Op     | Msg_type | Msg_text |
|---------------------------------------------------------|
| database_name.table_name | repair | status   | OK       |
|---------------------------------------------------------|

 

Ensure MariaDB now recognizes your stop words.

mariadb> show variables like 'ft%'
ft_boolean_syntax = + -><()~*:""&|
ft_max_word_len = 84
ft_min_word_len = 3
ft_query_expansion_limit = 20
ft_stopword_file = /var/www/stopwords

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 9a9128 in the box below so that we can be sure you are a human.