MySQL全文MATCH,AGAINST返回0个结果教程
我正在尝试追踪:http://dev.mysql.com/doc/refman/4.1/en/fulltext-natural-language.html
以提高搜索查询的速度和按分数排序的能力.
但是,当使用此SQL时(“ skitt”被用作搜索项只是为了尝试匹配Skittles).
SELECT
id,name,description,price,image,
MATCH (name,description)
AGAINST ('skitt')
AS score
FROM
products
WHERE
MATCH (name,description)
AGAINST ('skitt')
它返回0个结果.我试图找出原因,我不确定我可能将索引设置错误了,我不确定,这是我第一次偏离LIKE!
这是我的表结构和数据:
谢谢!
解决方法:
默认情况下,某些单词会从搜索中排除.这些称为stopwords.“ a”是停用词的示例.您可以使用非停用词来测试查询,也可以禁用停用词:
How can I write full search index query which will not consider any stopwords?
如果您还想匹配前缀,请使用truncation operator in boolean mode:
*
The asterisk serves as the truncation (or wildcard) operator. Unlike the other operators, it should be appended to the word to be affected. Words match if they begin with the word preceding the * operator.