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 Steve Radhouani <r....@gmail.com> on 2010/03/10 11:37:54 UTC

Solrj - Sorting with range queries

Using Solrj, I would like to sort the response of a range query based on
some specific labels. For instance, using the query:

facet=true
&facet.query={!key= Less than 100}[* TO 99]
&facet.query={!key=100 - 200}[100 TO 200]
&facet.query={!key=200 +}[201 TO *]

I would like to display the response in the following order:

Less than 100 (x)
100 - 200 (y)
201 + (z)

independently on the values of x, y, z which are the numbers of the
retrieved documents for each range.


Any ideas?

Thanks

Re: Solrj - Sorting with range queries

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Mar 10, 2010 at 10:57 AM, Steve Radhouani <r....@gmail.com> wrote:
> I noticed that, Yonik, but I couldnt figure out how to preserve the
> "correct" order produced by Solr. Do you have any idea how to preserve it?

Open a JIRA issue for this.
We prob just need to change
    _facetQuery = new HashMap<String, Integer>();
to
    _facetQuery = new Linked HashMap<String, Integer>();

-Yonik
http://www.lucidimagination.com

> Thanks.
>
> 2010/3/10 Yonik Seeley <yo...@lucidimagination.com>
>
>> On Wed, Mar 10, 2010 at 9:49 AM, Steve Radhouani <r....@gmail.com>
>> wrote:
>> > Thanks Erik. That's what I've done so far, but I was wondering wether
>> there
>> > is a "cleaner" solution from Solr itself.
>>
>> Hmmm, AFAIK Solr itself will currently return the facet.query results
>> in the order they were specified.
>> So perhaps this is just a SolrJ thing, and it wouldn't be too hard to
>> preserve the order that it gets from Solr?
>>
>> -Yonik
>> http://www.lucidimagination.com
>>
>>
>> > -Steve
>> >
>> > 2010/3/10 Erik Hatcher <er...@gmail.com>
>> >
>> >> You're going to have to employ some UI work to make the arrangement how
>> you
>> >> like.  Order from Solr isn't going to be guaranteed.
>> >>
>> >>        Erik
>> >>
>> >>
>> >>
>> >> On Mar 10, 2010, at 5:37 AM, Steve Radhouani wrote:
>> >>
>> >>  Using Solrj, I would like to sort the response of a range query based
>> on
>> >>> some specific labels. For instance, using the query:
>> >>>
>> >>> facet=true
>> >>> &facet.query={!key= Less than 100}[* TO 99]
>> >>> &facet.query={!key=100 - 200}[100 TO 200]
>> >>> &facet.query={!key=200 +}[201 TO *]
>> >>>
>> >>> I would like to display the response in the following order:
>> >>>
>> >>> Less than 100 (x)
>> >>> 100 - 200 (y)
>> >>> 201 + (z)
>> >>>
>> >>> independently on the values of x, y, z which are the numbers of the
>> >>> retrieved documents for each range.
>> >>>
>> >>>
>> >>> Any ideas?
>> >>>
>> >>> Thanks
>> >>>
>> >>
>> >>
>> >
>>
>

Re: Solrj - Sorting with range queries

Posted by Steve Radhouani <r....@gmail.com>.
I noticed that, Yonik, but I couldnt figure out how to preserve the
"correct" order produced by Solr. Do you have any idea how to preserve it?

Thanks.

2010/3/10 Yonik Seeley <yo...@lucidimagination.com>

> On Wed, Mar 10, 2010 at 9:49 AM, Steve Radhouani <r....@gmail.com>
> wrote:
> > Thanks Erik. That's what I've done so far, but I was wondering wether
> there
> > is a "cleaner" solution from Solr itself.
>
> Hmmm, AFAIK Solr itself will currently return the facet.query results
> in the order they were specified.
> So perhaps this is just a SolrJ thing, and it wouldn't be too hard to
> preserve the order that it gets from Solr?
>
> -Yonik
> http://www.lucidimagination.com
>
>
> > -Steve
> >
> > 2010/3/10 Erik Hatcher <er...@gmail.com>
> >
> >> You're going to have to employ some UI work to make the arrangement how
> you
> >> like.  Order from Solr isn't going to be guaranteed.
> >>
> >>        Erik
> >>
> >>
> >>
> >> On Mar 10, 2010, at 5:37 AM, Steve Radhouani wrote:
> >>
> >>  Using Solrj, I would like to sort the response of a range query based
> on
> >>> some specific labels. For instance, using the query:
> >>>
> >>> facet=true
> >>> &facet.query={!key= Less than 100}[* TO 99]
> >>> &facet.query={!key=100 - 200}[100 TO 200]
> >>> &facet.query={!key=200 +}[201 TO *]
> >>>
> >>> I would like to display the response in the following order:
> >>>
> >>> Less than 100 (x)
> >>> 100 - 200 (y)
> >>> 201 + (z)
> >>>
> >>> independently on the values of x, y, z which are the numbers of the
> >>> retrieved documents for each range.
> >>>
> >>>
> >>> Any ideas?
> >>>
> >>> Thanks
> >>>
> >>
> >>
> >
>

Re: Solrj - Sorting with range queries

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Mar 10, 2010 at 9:49 AM, Steve Radhouani <r....@gmail.com> wrote:
> Thanks Erik. That's what I've done so far, but I was wondering wether there
> is a "cleaner" solution from Solr itself.

Hmmm, AFAIK Solr itself will currently return the facet.query results
in the order they were specified.
So perhaps this is just a SolrJ thing, and it wouldn't be too hard to
preserve the order that it gets from Solr?

-Yonik
http://www.lucidimagination.com


> -Steve
>
> 2010/3/10 Erik Hatcher <er...@gmail.com>
>
>> You're going to have to employ some UI work to make the arrangement how you
>> like.  Order from Solr isn't going to be guaranteed.
>>
>>        Erik
>>
>>
>>
>> On Mar 10, 2010, at 5:37 AM, Steve Radhouani wrote:
>>
>>  Using Solrj, I would like to sort the response of a range query based on
>>> some specific labels. For instance, using the query:
>>>
>>> facet=true
>>> &facet.query={!key= Less than 100}[* TO 99]
>>> &facet.query={!key=100 - 200}[100 TO 200]
>>> &facet.query={!key=200 +}[201 TO *]
>>>
>>> I would like to display the response in the following order:
>>>
>>> Less than 100 (x)
>>> 100 - 200 (y)
>>> 201 + (z)
>>>
>>> independently on the values of x, y, z which are the numbers of the
>>> retrieved documents for each range.
>>>
>>>
>>> Any ideas?
>>>
>>> Thanks
>>>
>>
>>
>

Re: Solrj - Sorting with range queries

Posted by Steve Radhouani <r....@gmail.com>.
Thanks Erik. That's what I've done so far, but I was wondering wether there
is a "cleaner" solution from Solr itself.

-Steve

2010/3/10 Erik Hatcher <er...@gmail.com>

> You're going to have to employ some UI work to make the arrangement how you
> like.  Order from Solr isn't going to be guaranteed.
>
>        Erik
>
>
>
> On Mar 10, 2010, at 5:37 AM, Steve Radhouani wrote:
>
>  Using Solrj, I would like to sort the response of a range query based on
>> some specific labels. For instance, using the query:
>>
>> facet=true
>> &facet.query={!key= Less than 100}[* TO 99]
>> &facet.query={!key=100 - 200}[100 TO 200]
>> &facet.query={!key=200 +}[201 TO *]
>>
>> I would like to display the response in the following order:
>>
>> Less than 100 (x)
>> 100 - 200 (y)
>> 201 + (z)
>>
>> independently on the values of x, y, z which are the numbers of the
>> retrieved documents for each range.
>>
>>
>> Any ideas?
>>
>> Thanks
>>
>
>

Re: Solrj - Sorting with range queries

Posted by Erik Hatcher <er...@gmail.com>.
You're going to have to employ some UI work to make the arrangement  
how you like.  Order from Solr isn't going to be guaranteed.

	Erik


On Mar 10, 2010, at 5:37 AM, Steve Radhouani wrote:

> Using Solrj, I would like to sort the response of a range query  
> based on
> some specific labels. For instance, using the query:
>
> facet=true
> &facet.query={!key= Less than 100}[* TO 99]
> &facet.query={!key=100 - 200}[100 TO 200]
> &facet.query={!key=200 +}[201 TO *]
>
> I would like to display the response in the following order:
>
> Less than 100 (x)
> 100 - 200 (y)
> 201 + (z)
>
> independently on the values of x, y, z which are the numbers of the
> retrieved documents for each range.
>
>
> Any ideas?
>
> Thanks