Bert
Bert

Reputation: 855

Mysql MATCH AGAINST short words

I want to display relevant products on a page. I use the following query:

SELECT item.*, MATCH (item.title) AGAINST ('M' IN BOOLEAN MODE) AS relevancy 
FROM __items AS item 
ORDER BY relevancy DESC

The table __items has a few items (id, title) and one with title just M.

I tried using an asterisk ('M*'), but it didn't work. Thanks for your help!

Upvotes: 2

Views: 1878

Answers (2)

Ukuser32
Ukuser32

Reputation: 2189

I'm adding this as an answer because it is different; ft_min_word_length relates to MYISAM tables but its different for InnoDB:

The minimum and maximum lengths of words to be indexed are defined by the innodb_ft_min_token_size and innodb_ft_max_token_size for InnoDB search indexes, and ft_min_word_len and ft_max_word_len for MyISAM ones.

This is based on the revised manual link of https://dev.mysql.com/doc/refman/8.0/en/fulltext-fine-tuning.html (v8 of MySQL)

Upvotes: 0

Özge Şahin
Özge Şahin

Reputation: 41

You should decrease MySQL parameter ft_min_word_length=1 on your my.cnf.

Upvotes: 3

Related Questions