solr - 在一个请求中执行多个查询

问题描述 投票:0回答:3

有没有办法在单个 solr 请求中执行多个查询并将结果的联合作为响应

我的简化模式看起来像一个名称字段和一个类型字段(4-5 种不同类型),我希望每个类型值有 10 个结果。这可以在 solr 中完成吗?

solr union
3个回答
4
投票

目前不可能,看看这个请求,可能当这个修复到位时

https://issues.apache.org/jira/browse/SOLR-1093


1
投票

我认为这可以通过 Field Collapsing 来完成

http://wiki.apache.org/solr/FieldCollapsing#Quick_Start

他们的例子是相似的,除了他们将价格分成范围而不是类型:

我们可以使用 group.query 命令(很像 facet.query)找到也匹配任意查询的顶级文档。例如,我们可以使用它来查找不同价格范围内的前 3 个文档:

http://localhost:8983/solr/select?wt=json&indent=true&fl=name,price&q=memory&group=true&group.query=price:[0+TO+99.99]&group.query=price:[100+TO+*]&group.limit=3

在你的情况下 group.limit=10.


© www.soinside.com 2019 - 2024. All rights reserved.