本文介绍了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:

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

08-14 20:21