我有一个类似的查询,我在几个不同的表中使用,但是在这张桌子上,出于某种原因我的所有结果都与相关性为0 ..有没有人提供一些问题为什么会发生这种情况?
干杯
SELECT City,
MATCH (
Street, City, State, Zipcode
)
AGAINST (
'San|Diego'
) AS Relevance FROM address_list
WHERE 1
AND MATCH (
Street, City, State, Zipcode
)
AGAINST (
'+San|Diego'
IN BOOLEAN
MODE
)
ORDER BY Relevance DESC
我的完整索引是:街道,城市,州,邮政编码 DB:MyISAM
适用于除此之外的所有其他表格。
Select * from address_list where City='San Diego'
我的名单很好,所以我真的卡住了。
想法?
答案 0 :(得分:0)
ft_min_word_len可能是问题所在。默认值为4,因此单词“san”不会包含在索引中。
以下是检查方法:
show variables like 'ft_min_word_len';
答案 1 :(得分:0)
您应该在where子句中使用的select子句中使用相同的MATCH():
SELECT City,
MATCH (
Street, City, State, Zipcode
)
AGAINST (
'+San|Diego'
IN BOOLEAN
MODE
) AS Relevance FROM address_list
WHERE 1
AND MATCH (
Street, City, State, Zipcode
)
AGAINST (
'+San|Diego'
IN BOOLEAN
MODE
)
ORDER BY Relevance DESC