我试图根据相关性和一些顺序来命令我的结果
SELECT d.s_title, oc_t_item.*, oc_t_item.s_contact_name as s_user_name,
MATCH (d.s_title) AGAINST ('"myvi xt"') AS exact_phrase,
MATCH (d.s_title) AGAINST ('+myvi +xt"') AS both_keyword
FROM (oc_t_item) LEFT JOIN oc_t_item_description as d
ON d.fk_i_item_id = oc_t_item.pk_i_id
WHERE MATCH(d.s_title) AGAINST('myvi xt' IN BOOLEAN MODE)
ORDER BY exact_phrase desc, both_keyword desc LIMIT 1000
以上查询将返回以下结果
所以问题是结果应该先用精确的短语排序,例如" Myvi XT "然后按照" Myvi一些文字XT "但我已经使用了ORDER BY exact_phrase desc, both_keyword desc
答案 0 :(得分:1)
默认情况下,MySQL中全文搜索的最小字长为4个字母。这意味着忽略任何更短的东西。以下是相关的documentation:
ft_min_word_len
Command-Line Format --ft_min_word_len=#
Option-File Format ft_min_word_len
System Variable Name ft_min_word_len
Variable Scope Global
Dynamic Variable No
Permitted Values
Type numeric
Default 4
Min Value 1
The minimum length of the word to be included in a MyISAM FULLTEXT index.
Note
FULLTEXT indexes on MyISAM tables must be rebuilt after changing this variable. Use REPAIR TABLE tbl_name QUICK.
换句话说,除非您更改了此默认设置,否则查询中将完全忽略单词'xt'
。