lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Høydahl <jan....@cominvent.com>
Subject Re: Custom Sorting
Date Tue, 19 Apr 2011 17:43:27 GMT
Hi,

Not possible :)
Lucene compares each matching document against the query and produces a score for each.
Documents are not compared to eachother like normal sort, that would be way too costly.

But if you explain your use case, I'm sure we can find ways to express your needs in other
ways

Perhaps it is possible for you to use Sort by Function? http://wiki.apache.org/solr/FunctionQuery#Sort_By_Function
Then you can decide exactly what goes into your sort score.
If you want to do conditional stuff, you may need to pre-process your documents a bit and
create new fields which can be used in a FunctionQuery.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

On 19. apr. 2011, at 19.02, Michael Owen wrote:

> 
> Hi,
> I want to able to have a custom sorting algorithm such that for each comparison of document
results (A v B) I can rank them. i.e. writing a comparator like I would normally do in Java
(Compares its two arguments for order. Returns a negative integer, zero, or a positive integer
as the first argument is less than, equal to, or greater than the second).
> In the comparator I want to be able to take into account the score of the results, as
well as other fields in the documents.
> I've looked at using things such as the score/boost/bf parameters etc, however, want
the flexibility of being able to code the comparator, so I can do if conditions and such.
> Is this possible? And if so what's the best way of doing this? I've upgraded to use the
latest version of Solr 3.1, and of course for this use case would expect to have to build
from source, in order to add custom source.
> Or/and, when using the score/boost/bf parameters etc - is it possible to use the score
parameter in functions, to say scale it between 0 and 1?
> Thanks
> Mike
> 
> 
> 
> 		 	   		  


Mime
View raw message