You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Asherman, Doug" <do...@cbs.com> on 2010/05/06 00:53:50 UTC
Sort by function
Hello:
I¹ve been reading through the docs trying to find a way to sort by a dynamic
value; preferably I¹d like to place a function into the configuration.
Something like:
Value=sum(sum(f1,f2,f3),sum(pow(x,4),f1))
The closest thing I can find is the ³sort by function², which doesn¹t seem
to be available in 1.4. If such a thing is possible in 1.4, could someone
point me to the pertinent part of the docs?
Thanks.
Re: Sort by function
Posted by Chris Hostetter <ho...@fucit.org>.
: Value=sum(sum(f1,f2,f3),sum(pow(x,4),f1))
: The closest thing I can find is the �sort by function�, which doesn�t seem
: to be available in 1.4. If such a thing is possible in 1.4, could someone
Hey doug: I think i was mistaken the last time we talked.
As you've discovered (and as Koji verified) Sort by function is not
available in Solr 1.4.
What you can do however (w/o applying any patches) is query on a function
so that the function result is used as the score, and then use filter
queries to constrain the resulting documents. for simple "i need to sort
by a function" purposes this works fine, what it can't deal with (cleanly)
is "i want to sort by a field desc, and then i want a secondary sort on a
funcA() asc, and then a tertiary sort on funcB() desc, ..."
ie...
q={!func}sum(sum(f1,f2,f3),sum(pow(x,4),f1))&fq=your+query&sort=score+desc
PS...
http://people.apache.org/~hossman/#solr-user
-Hoss
Re: Sort by function
Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
(10/05/06 7:53), Asherman, Doug wrote:
> Hello:
>
> I've been reading through the docs trying to find a way to sort by a
> dynamic value; preferably I'd like to place a function into the
> configuration. Something like:
>
> Value=sum(sum(f1,f2,f3),sum(pow(x,4),f1))
>
>
> The closest thing I can find is the "sort by function", which doesn't
> seem to be available in 1.4. If such a thing is possible in 1.4, could
> someone point me to the pertinent part of the docs?
>
> Thanks.
Sort by Function ia available in branch_3x. Here is the patch:
https://issues.apache.org/jira/browse/SOLR-1297
Koji
--
http://www.rondhuit.com/en/