I am using the following query:
SELECT
(SELECT COUNT(*) FROM blah
WHERE MATCH(text) AGAINST ('c')
) as count1,
(SELECT COUNT(*) FROM blah
WHERE text LIKE '% c %'
) as count2
This returns:
count1 count2
0 19
Why is that?
Note that ft_min_word_len is set as 1 and indexes have been rebuilt. Why is it not working? 😐
The field blah has strings such as “y c h g b g p q n g j f k t y u a w d v b e x c m”.
First, MySQL full-text search defaults to natural language mode. You need to use the
IN BOOLEAN MODEkeyword to switch to boolean mode, which supports the*operator.Second, your full-text query finds entries that contain a word (of four or more letters and not in the stopword list) beginning with the letter
c. Meanwhile, yourLIKEquery finds any entries that contain the lettercanywhere, even if it’s in the middle of a word.