You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Vineet Mangla <vi...@bold.com> on 2018/01/05 04:47:19 UTC

Solr - custom ordering

Hi,

 

We have a Solr cloud core where "jobid" is our primary key. We have a use
case where we have a list of 15000 jobids in a particular order in an
external system. We are calling solr with these 15000 jobids as filter query
and in result, we want all the jobids after filtering in the same order of
input. Is this possible in Solr?

 

 

 

 

Thanks & Regards

Vineet Mangla | Project Lead

 



BOLD Technology Systems Pvt. Ltd.

(formerly LiveCareer)

Aykon Tower, Plot No. 4, Sector - 135, Noida-201301

URL- -  <http://www.bold.com> www.bold.com | Cell: +91 (965) 088 0606

 


Re: Solr - custom ordering

Posted by Erik Hatcher <er...@gmail.com>.
Vineet -

Solr’s QueryElevationComponent can do this. 

Or you could use a query like:

   q=id:C^=300 id:B^=200 id:A^=100

The ^= is a constant score syntax, so you can assign a “score” to a clause (in this case a single document with a unique id).   

	Erik


> On Jan 4, 2018, at 11:47 PM, Vineet Mangla <vi...@bold.com> wrote:
> 
> Hi,
>  
> We have a Solr cloud core where “jobid” is our primary key. We have a use case where we have a list of 15000 jobids in a particular order in an external system. We are calling solr with these 15000 jobids as filter query and in result, we want all the jobids after filtering in the same order of input. Is this possible in Solr?
>  
>  
>  
>  
> Thanks & Regards
> Vineet Mangla | Project Lead
>  
> 
> BOLD Technology Systems Pvt. Ltd.
> (formerly LiveCareer)
> Aykon Tower, Plot No. 4, Sector – 135, Noida-201301
> URL- - www.bold.com <http://www.bold.com/> | Cell: +91 (965) 088 0606


Re: Solr - custom ordering

Posted by Emir Arnautović <em...@sematext.com>.
Hi,
Solr can return documents by score or some field value. In case of all docs having the same score, it’ll use its internal id to sort docs. That being said, you have two choices:
1. sort jobids in your fq and sort by jobid (in this case you should use terms query parser)
2. use q instead of fq and boost different values differently, e.g. q=jobid:(456^15000 OR 123^14999…)

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 5 Jan 2018, at 05:47, Vineet Mangla <vi...@bold.com> wrote:
> 
> Hi,
>  
> We have a Solr cloud core where “jobid” is our primary key. We have a use case where we have a list of 15000 jobids in a particular order in an external system. We are calling solr with these 15000 jobids as filter query and in result, we want all the jobids after filtering in the same order of input. Is this possible in Solr?
>  
>  
>  
>  
> Thanks & Regards
> Vineet Mangla | Project Lead
>  
> 
> BOLD Technology Systems Pvt. Ltd.
> (formerly LiveCareer)
> Aykon Tower, Plot No. 4, Sector – 135, Noida-201301
> URL- - www.bold.com <http://www.bold.com/> | Cell: +91 (965) 088 0606