Reputation: 678
Many users are going to search my InnoDB MySQL database for terms like "The Gap", "BT group" or "IG Index" etc. I don't want to annoy them with "zero results".
My code is like this:
SELECT COUNT(1) FROM `myTable` WHERE MATCH(tagline) AGAINST('+the +gap' IN BOOLEAN MODE)
One approach would be to remove all stopwords from the queries through PHP, but then I would need to find the full list of stopwords.
I decided to just remove stopwords, following the steps here:
I added these lines to my.cnf file:
innodb_ft_min_token_size=2
ft_min_word_len=2
ft_stopword_file = ""
I emptied my table, ran this SQL in PHPMyAdmin: SET @@SESSION.innodb_ft_enable_stopword = 'OFF';
and rebuilt the indexes and added new data.
I am still getting zero results for short terms like "the" and so on.
Upvotes: 0
Views: 399
Reputation: 678
Seems to be working now: as @Shadow pointed out, you need to set the variable globally. So:
Added this to my.cnf file:
innodb_ft_min_token_size=2
ft_min_word_len=2
ft_stopword_file = ""
And ensured that this MySQL system variable was set globally:
innodb_ft_enable_stopword = 'OFF';
Upvotes: 1