I was wondering if it is possible to sort by the order that you request documents from SOLR. I am running a In based query and would just like SOLR to return them based on the order that I ask.
In (4,2,3,1) should return me documents ordered 4,2,3,1.
Thanks.
You need Sorting in solr, to order them by field.
I assume that “In based query” means something like: fetch docs whose
fieldxhas values in (val1,val2). You can a field as multi-valued field and facet on that field. A facet query is a ‘is in’ search, out of the box (so to say) and it can do more sophisticated searches too.Edited on OP’s query:
Updating a document with a multi-valued field in JSON here. See the line
As for doing a facet query, check this.
You need to do one or more fq statements:
Also do read up on the fact (in link above) that you need to facet on stored rather than indexed fields.