对于 Solr 中的过滤器查询,我需要包含所有非特定类型的文档,以及在特定字段中具有值的该类型的任何文档。
我试过这个:
fq=(-type_id:(A) OR content:(['' TO *]))
但它不包括type_id
具有 null 的 B、C 等文档content
。(type_id
是一个string
字段并且content
是text
.)
我看过这个问题:Complex SOLR query including NOT and OR和这篇关于运算符的帖子:http ://robotlibrarian.billdueber.com/2011/12/solr-and-boolean-operators/ 。我认为我的语法应该是正确的。谁能看到我的错误?
更新:我正在使用 LuceneQParser。它将上面的过滤查询解析为
-type_id:A content:['' TO *]
-type_id:A OR (content:[* TO *] AND type_id:A)
它将评论 ( ) 中建议的过滤器查询解析为
-type_id:A (+content:[* TO *] +type_id:A)
所以没有结果。