MySQL全文MATCH,反对返回0结果 [英] mysql fulltext MATCH,AGAINST returning 0 results

查看:111
本文介绍了MySQL全文MATCH,反对返回0结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试遵循:。 a是停用词的一个例子。您可以使用不是停用词的词来测试您的查询,也可以禁用停用词: //stackoverflow.com/questions/2839135/how-can-i-write-full-search-index-query-which-will-not-consider-any-stopwords\">如何编写完整的搜索索引查询考虑任何停用词?


如果您还想匹配前缀,请使用以布尔模式运行截断运算符


*



星号用作截断(或通配符)运算符。与其他操作员不同,它应该被附加到要影响的单词上。如果它们以*运算符之前的单词开头,则单词匹配。



I am trying to follow: http://dev.mysql.com/doc/refman/4.1/en/fulltext-natural-language.html

in an attempt to improve search queries, both in speed and the ability to order by score.

However when using this SQL ("skitt" is used as a search term just so I can try match Skittles).

SELECT 
    id,name,description,price,image, 
    MATCH (name,description) 
    AGAINST ('skitt') 
    AS score 
FROM 
    products 
WHERE 
    MATCH (name,description)
AGAINST ('skitt')

it returns 0 results. I am trying to find out why, I think I might have set my index's up wrong I'm not sure, this is the first time I've strayed away from LIKE!

Here is my table structure and data:

Thank you!

解决方案

By default certain words are excluded from the search. These are called stopwords. "a" is an example of a stopword. You could test your query by using a word that is not a stopword, or you can disable stopwords:

If you want to also match prefixes use the 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.

这篇关于MySQL全文MATCH,反对返回0结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆