删除 solr 查询语法中的过期记录
我在 solr 1.4 上遇到了 solr 查询语法问题(我认为)。我正在尝试从 solr 查询中排除过期记录。但是,如果该记录没有过期记录,我也想将该记录带回来。例如,
为了仅获取尚未过期的记录列表,我正在使用此查询:
expirydate:[NOW/DAY TO *]
然后我想获取一个没有有过期日期的记录列表,我可以使用
-expirydate:[* TO *]
这两个查询都 可以使用他们自己的。即第一个查询返回 3 条记录。第二个查询返回 921 条记录。然而,当我将 2 个查询与 OR 组合在一起时,我得到 0 条记录:
expirydate:[NOW/DAY TO *] OR -expirydate:[* TO *]
知道我做错了什么吗?
谢谢
戴夫
I'm having a solr query syntax issue (I think) with solr 1.4. I'm trying exclude expired records from a solr query. However if the record doesn't have an expiry record, i would like to bring that record back also. E.g.
To only get a list of record that haven't expired i am using this query:
expirydate:[NOW/DAY TO *]
Then I thought to get a list of records which don't have an expiry date i can use
-expirydate:[* TO *]
Both queries work on their own. I.e. the first query brings back 3 records. The 2nd query brings back 921 records. However when I combine the 2 queries together with an OR I get 0 records:
expirydate:[NOW/DAY TO *] OR -expirydate:[* TO *]
Any ideas what I'm doing wrong?
Thanks
Dave
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里不是 100% 确定,但我认为你不能以这种方式将 OR 与否定运算符结合起来。
尝试在每个文档中添加具有相同值的虚拟字段并尝试
Not 100% sure here, but I don't think you can combine OR with the negation operator in this manner.
Try adding a dummy field with the same value in every document and try
我只需要解决这个问题,我就开始实施已批准的答案,但后来意识到我可以这样做:
无论文档是否设置了过期日期,该方法都有效。
I just had to tackle this problem, I went about implementing the approved answer but then realized that I could just do this:
That worked regardless if the document had expired-date set.