2

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!

Nikola K.
  • 6,813
  • 13
  • 27
  • 39
Bert
  • 785
  • 2
  • 5
  • 16

2 Answers2

3

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

bluish
  • 23,093
  • 23
  • 110
  • 171
  • 2
    should that not be `ft_min_word_len=1` ? ref: http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html – bottleboot Jul 31 '13 at 10:45
0

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)

Ukuser32
  • 1,941
  • 2
  • 17
  • 30