solr - execute multiple queries in one request
Asked Answered
E

4

8

Is there a way to execute multiple queries in a single solr request and get the union of results as response

my simplified schema would look like a name field and a type field(4-5 different types) and I want 10 results per type value. can this be done in solr?

Eeg answered 8/12, 2010 at 13:31 Comment(1)
Not possible to perform several requests and federate the results client-side?Imagery
S
4

Currently not possible, Look at this request, possibly when this fix is in place

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

Supersensible answered 23/9, 2011 at 21:37 Comment(0)
A
2

I think this can be done w/ Field Collapsing

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

Their example is similar except instead of types they are splitting the price into ranges:

We can find the top documents that also match arbitrary queries with the group.query command (much like facet.query). For example, we could use this to find the top 3 documents with in different price ranges:

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

In your case group.limit=10.

Aggression answered 11/11, 2013 at 19:56 Comment(1)
I think this should be the accepted answer.Tortilla
E
1

This can be accomplished by field grouping or field collapsing.

For example: (separate lines for readability)

http://mysolrhost/select?
&q=*
&fl=name,type
&count=50
&group=true
&group.field=type
&group.limit=10
&group.main=true

References:

Related question with additional details:

Euonymus answered 23/3, 2023 at 16:46 Comment(0)
S
0

Federated Search

Distributed Search - needs all the definition schemas to look the same

Scanlon answered 8/12, 2010 at 15:57 Comment(1)
Federated search was renamed as distributed one (for that's what it was apparently), both links point to same page now.Ausgleich

© 2022 - 2024 — McMap. All rights reserved.