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 vraa <al...@gmail.com> on 2011/11/23 09:29:31 UTC

Sort question

Hi

I have a query where i sort by a column "price". This field can contain the
following values

100000
75000
150000
1
225000
50
40

I want to sort these values so that always between 0 and 100 always comes
last.

Eg sorting by price asc should look like this:
75000
100000
150000
225000
1
40
50

Is this possible?

--
View this message in context: http://lucene.472066.n3.nabble.com/Sort-question-tp3530070p3530070.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Sort question

Posted by Phil Hoy <ph...@friendsreunited.co.uk>.
You might be able to sort by the map function q=*:*&sort=map(price,0,100, 100000) asc, price asc.

Phil

-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com] 
Sent: 25 November 2011 13:49
To: solr-user@lucene.apache.org
Subject: Re: Sort question

Not that I know of. You could conceivably do some
work at index time to create a field that would sort
in that order by doing some sort of mapping from
these values into a field that sorts the way you
want, or you might be able to do a plugin

Best
Erick

On Wed, Nov 23, 2011 at 3:29 AM, vraa <al...@gmail.com> wrote:
> Hi
>
> I have a query where i sort by a column "price". This field can contain the
> following values
>
> 100000
> 75000
> 150000
> 1
> 225000
> 50
> 40
>
> I want to sort these values so that always between 0 and 100 always comes
> last.
>
> Eg sorting by price asc should look like this:
> 75000
> 100000
> 150000
> 225000
> 1
> 40
> 50
>
> Is this possible?
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Sort-question-tp3530070p3530070.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

______________________________________________________________________
This email has been scanned by the brightsolid Email Security System. Powered by MessageLabs
______________________________________________________________________

Re: Sort question

Posted by Erick Erickson <er...@gmail.com>.
Not that I know of. You could conceivably do some
work at index time to create a field that would sort
in that order by doing some sort of mapping from
these values into a field that sorts the way you
want, or you might be able to do a plugin

Best
Erick

On Wed, Nov 23, 2011 at 3:29 AM, vraa <al...@gmail.com> wrote:
> Hi
>
> I have a query where i sort by a column "price". This field can contain the
> following values
>
> 100000
> 75000
> 150000
> 1
> 225000
> 50
> 40
>
> I want to sort these values so that always between 0 and 100 always comes
> last.
>
> Eg sorting by price asc should look like this:
> 75000
> 100000
> 150000
> 225000
> 1
> 40
> 50
>
> Is this possible?
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Sort-question-tp3530070p3530070.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>