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 Atita Arora <at...@gmail.com> on 2019/05/09 12:55:19 UTC

Retrieving docs in the same order as provided in the query

Hi,

 Is there someway way to retrieve the docs in the same order as queried in
the solr query?

I am aware of leveraging bq for this and have even tried overriding custom
similarity to achieve this but I am looking for something simpler.

Please enlighten me.

Best Regards,
Atita

Re: Retrieving docs in the same order as provided in the query

Posted by Erik Hatcher <er...@gmail.com>.
So yeah, this constant score trick isn't meant for a "large" list, of course.

For bigger result sets, the ExternalFileField feature would be one way to go.   Or maybe the QueryElevationComponent.   And I suppose also, the LTR feature could be abused for this?

	Erik



> On May 9, 2019, at 9:35 AM, Atita Arora <at...@gmail.com> wrote:
> 
> Sure,
> I can give this a shot! Hope it works out well for bigger resultsets too :)
> 
> Big Thanks, Erik :)
> 
> 
> 
> On Thu, May 9, 2019 at 3:20 PM Erik Hatcher <er...@gmail.com> wrote:
> 
>> Atita -
>> 
>> You mean something like q=id:(X Y Z) to be able to order them arbitrarily?
>> 
>> Yes, you can use the constant score query syntax to set the score, e.g.:
>> 
>>   q=id:Z^=3 OR id:Y^=2 OR id:X^=1
>> 
>> Hope that helps.
>> 
>>        Erik
>> 
>> 
>>> On May 9, 2019, at 8:55 AM, Atita Arora <at...@gmail.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Is there someway way to retrieve the docs in the same order as queried in
>>> the solr query?
>>> 
>>> I am aware of leveraging bq for this and have even tried overriding
>> custom
>>> similarity to achieve this but I am looking for something simpler.
>>> 
>>> Please enlighten me.
>>> 
>>> Best Regards,
>>> Atita
>> 
>> 


Re: Retrieving docs in the same order as provided in the query

Posted by Atita Arora <at...@gmail.com>.
Sure,
I can give this a shot! Hope it works out well for bigger resultsets too :)

Big Thanks, Erik :)



On Thu, May 9, 2019 at 3:20 PM Erik Hatcher <er...@gmail.com> wrote:

> Atita -
>
> You mean something like q=id:(X Y Z) to be able to order them arbitrarily?
>
> Yes, you can use the constant score query syntax to set the score, e.g.:
>
>    q=id:Z^=3 OR id:Y^=2 OR id:X^=1
>
> Hope that helps.
>
>         Erik
>
>
> > On May 9, 2019, at 8:55 AM, Atita Arora <at...@gmail.com> wrote:
> >
> > Hi,
> >
> > Is there someway way to retrieve the docs in the same order as queried in
> > the solr query?
> >
> > I am aware of leveraging bq for this and have even tried overriding
> custom
> > similarity to achieve this but I am looking for something simpler.
> >
> > Please enlighten me.
> >
> > Best Regards,
> > Atita
>
>

Re: Retrieving docs in the same order as provided in the query

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

You mean something like q=id:(X Y Z) to be able to order them arbitrarily?

Yes, you can use the constant score query syntax to set the score, e.g.:

   q=id:Z^=3 OR id:Y^=2 OR id:X^=1

Hope that helps.

	Erik


> On May 9, 2019, at 8:55 AM, Atita Arora <at...@gmail.com> wrote:
> 
> Hi,
> 
> Is there someway way to retrieve the docs in the same order as queried in
> the solr query?
> 
> I am aware of leveraging bq for this and have even tried overriding custom
> similarity to achieve this but I am looking for something simpler.
> 
> Please enlighten me.
> 
> Best Regards,
> Atita