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: u...@thetaphi.de

> -----Original Message-----
> From: Chetan Shah [mailto:chetankrs...@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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to