SQlite3 fts否定搜索 [英] SQlite3 fts negate search

查看:130
本文介绍了SQlite3 fts否定搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,感谢您的光临!

我正在搜索包含某些字符串的文章,并且需要全文搜索,就像这样:

I'm searching for articles which contain certain strings with full text search, something like this:

SELECT * FROM Articles_fts WHERE body MATCH 'monkey OR banana OR "hungry gorilla"';

我的实际搜索时间更长(22个字词),可能不是最明智的搜索方式,但是它可以正常工作,所以在那里没有问题.

My real search is much longer (22 terms) and probably not the smartest way of doing this but it's working so no problems there.

我需要什么帮助... 现在,我想返回此搜索返回的结果的对立面.换句话说,我希望所有不包含猴子,香蕉或饥饿的大猩猩"的文章.

What I need help with... Now I want to return the OPPOSITE of what this search returns. In other words I want all the articles that don't contain monkey, banana, or "hungry gorilla".

非常感谢!

推荐答案

仅当使用启用了增强的FTS查询语法.

否则,您可以使用SQL set操作对结果求反:

Otherwise, you can use SQL set operations to negate the result:

SELECT *
FROM Articles
WHERE id NOT IN (SELECT docid
                 FROM Articles_fts
                 WHERE body MATCH '...')

这篇关于SQlite3 fts否定搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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