开发者

solr query without order

开发者 https://www.devze.com 2023-02-28 05:17 出处:网络
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.

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

精彩评论

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