如何在 Solr 中进行 NOT IN 查询? [英] How to do NOT IN query in Solr?
本文介绍了如何在 Solr 中进行 NOT IN 查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从 Solr 结果集中排除一组文档 ID?本质上类似于
How can I exclude a set of document IDs from Solr result set? Essentially something like
/select?q=tag_id:367 AND NOT id:(306670,302209)
我试过了,它不排除带有这些 ID 的文档.
I tried it and it does not exclude documents with those id's.
推荐答案
试试这个:
/select?q=*:*&fq=tag_id:367 AND id:[* TO *] -id:(306670 302209)
这应该允许您根据需要构建添加任意数量的 ID,而不必每次要删除 ID 时都添加 -id:302209
.反之亦然,您可以将 -
与 +
交换并强制一组值也在那里.
That should allow you to build out add as many ids as you want without having to add -id:302209
every time you want to eliminate an ID. The reverse is also true, you can swap the -
with a +
and force an array of values to be there as well.
这篇关于如何在 Solr 中进行 NOT IN 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文