Solr的筛选查询在内的不和OR [英] Solr filter query including NOT and OR

查看:2077
本文介绍了Solr的筛选查询在内的不和OR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关Solr中的过滤器查询,我需要包括在某个域值的所有文件不是某种类型,以及该类型的任何文件。

For a filter query in Solr, I need to include all documents not of a certain type, plus any documents of that type which have a value in a certain field.

我试过这样:

fq=(-type_id:(A) OR content:(['' TO *]))

但它不包括 TYPE_ID B,C等,具有空内容的文件。 ( TYPE_ID 字符串字段和内容文本

But it is excluding documents of type_id B, C, etc. which have null content. (type_id is a string field and content is text.)

我已经看到了这个问题:复杂SOLR查询在内的不和或和这个职位有关运算符:<一href=\"http://robotlibrarian.billdueber.com/solr-and-boolean-operators/\">http://robotlibrarian.billdueber.com/solr-and-boolean-operators/.我觉得语法我应该是正确的。任何人都可以看到我的错误?

I have seen this question: Complex SOLR query including NOT and OR and this post about operators: http://robotlibrarian.billdueber.com/solr-and-boolean-operators/. I think the syntax I have should be correct. Can anyone see my error?

更新:我使用的是LuceneQParser。它分析筛选器查询上文

Update: I am using the LuceneQParser. It parses the filter query above as

-type_id:A content:['' TO *]

它分析筛选查询中的意见建议( -type_id:A OR(内容:[*到*]和TYPE_ID:A))的

-type_id:A (+content:[* TO *] +type_id:A)

所以没有结果。

推荐答案

在否定需要一套完整的来匹配它,所以你的过滤器应该是:

The negation needs a complete set to match against it, so your filter should be:

fq=((*:* AND -type_id:A) OR content:(['' TO *]))

这篇关于Solr的筛选查询在内的不和OR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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