lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Sort Collection of ScoreDocs
Date Mon, 02 Mar 2009 16:22:15 GMT
How about java.util.Arrays.sort() on the array using a simple
Comparator<ScoreDoc> with a compare() that returns -Float.compare(a.score,
b.score)? This is just about 7 lines of Java code.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Chetan Shah [mailto:chetankrshah@gmail.com]
> Sent: Monday, March 02, 2009 4:47 PM
> To: java-user@lucene.apache.org
> Subject: Sort Collection of ScoreDocs
> 
> 
> Is there an existing Utility class which will sort a collection of
> ScoreDocs
> ? I have a result set (array of ScoreDocs) stored in JVM and want to sort
> them by relevanceScore. I do not want to execute the query again. The
> stored
> result set is sorted by another term and hence the need.
> 
> Would highly appreciate if you would please let me know how do I do so?
> 
> Thanks,
> 
> -Chetan
> --
> View this message in context: http://www.nabble.com/Sort-Collection-of-
> ScoreDocs-tp22290563p22290563.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message