关于Solr中的布尔逻辑
我有一个带有年份字段的 Solr 索引,我可以使用以下查询来查询一定年份范围内的所有结果,该查询运行良好
*:* AND year:[1934 TO 1950]
我将如何合并 AND 运算符,以便我可以搜索多个选定年份的结果,例如。仅 1930 年和 1950 年的结果。我尝试过类似的操作:
*:* AND year:1934 AND year:1950
上面的查询没有显示任何结果。
I have a Solr index with a year field, I can query all results within a range of years using the following query which works fine
*:* AND year:[1934 TO 1950]
How would I incorporate the AND operator so I can search for results in a number of selected years, eg. results for year 1930 AND year 1950 only. I tried something like:
*:* AND year:1934 AND year:1950
the above query displays no results.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的不显示结果,因为两个年份都不可能匹配(但这就是表达式所说的内容)。
Your's does not display a result because there can be no match in both years (but that's what what the expression says).
*:* AND Year:[1934 TO 1950]
,只需year:[1934 TO 1950]
就足够了。*:* AND year:[1934 TO 1950]
, justyear:[1934 TO 1950]
is enough.year
is a multivalued field you probably wantyear:1934 OR year:1950