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 Erik Earle <er...@yahoo.com> on 2009/08/25 01:57:28 UTC

Solr Query help - sorting

Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query.


name  |  width  |  length
A     |  100    |  10
B     |  10     |  90
C     |  80     |  10
...


My indexed fields are:  name, width, length

Is there a way to query so that my data returns the order:  A, B, C


      

Re: Solr Query help - sorting

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
How about using sum() FunctionQuery, via:

http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22

Thanks,

Koji


Erik Earle wrote:
> Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query.
>
>
> name  |  width  |  length
> A     |  100    |  10
> B     |  10     |  90
> C     |  80     |  10
> ...
>
>
> My indexed fields are:  name, width, length
>
> Is there a way to query so that my data returns the order:  A, B, C
>
>
>       
>
>