MySQL全文搜索-仅包含所有单词的结果 [英] MySQL fulltext search - Only results that contain all words

查看:110
本文介绍了MySQL全文搜索-仅包含所有单词的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过以下查询,我得到的结果包含单词"International"和"Shipping",我还得到了包含"International"或"Shipping"的结果.我该怎么做才能确保结果包含两个单词,而不仅是其中一个?

With the following query I get results that contain the words "International" AND "Shipping" and I also get results that contain "International" OR "Shipping". What can I do to ensure that the results contain both words and not just one of them?

任何帮助将不胜感激,谢谢!

Any help would be greatly appreciated, thanks!

SELECT client_company,client_description,client_keywords
FROM tb_clients
WHERE
MATCH (client_company,client_description,client_keywords)
AGAINST ('International Shipping') > 0
LIMIT 10

推荐答案

在每个必需的单词前添加+并使用IN BOOLEAN MODE.

Add a + in front of every required word and use IN BOOLEAN MODE.

11.8.2.布尔型全文本搜索

在实现此功能时,MySQL使用有时称为隐式布尔逻辑的方法,其中

In implementing this feature, MySQL uses what is sometimes referred to as implied Boolean logic, in which

 + stands for AND
 - stands for NOT
  [no operator] implies OR

这篇关于MySQL全文搜索-仅包含所有单词的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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