简体   繁体   中英

MySQL FullText search returns 0 if multiple row matches

Match / Against returns true if I pass unique value in query and returns 0 if I pass value, which exist in multiple row.

SELECT MATCH(b.branch_name) 
AGAINST ('Men' IN NATURAL LANGUAGE MODE ), branch_name 
FROM `branch` AS `b` WHERE 1

Table Data:
id   | branch_name
--------------------
1    | Men 
2    | Beauty
3    | Women

If I pass MATCH(b.branch_name) AGAINST ('Men' IN NATURAL LANGUAGE MODE ) returns 0 for all row, If I pass MATCH(b.branch_name) AGAINST ('Women' IN NATURAL LANGUAGE MODE ) returns > 0 value same for 'beauty'

Can anyone please help me where am I wrong?

There is a system variable called ft_min_word_len whose default value is 4 (see here ).

That means that words of less than four letters are ignored -- not included in the index. No entry in the index; no rows returned.

Reset the value and then rebuild the index so "men" will be in the index. Then your query will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM