开发者

solr query without order

I have a solr index with the unique field as "id".

I have a ordered set of ids, using which I would like to query Solr. But I want the results in the same order.

so for example if i have the开发者_如何学Go ids id = [5,1,3,4] I want the results displayed in solr in same order.

I tried http://localhost:8983/solr/select/?q=id:(5 OR 1 OR 3 OR 4)&fl=id, but the results displayed are in ascending order.

Is their a way to query solr, and get results as I mentioned?


I think you can't, The results appear in the order they are indexed unless you specify a default sort field or the explicit sort field/order.


You can add another field to keep the initial sort order. You then can sort=field asc to retrieve the data in the original order.


The simple way is to query solr and sort the results in codes of yourself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜