lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Reuschling <>
Subject How to sort and get document scores afterwards
Date Thu, 15 Oct 2009 16:41:35 GMT

our application enables sorting the result lists according to field values,
currently all represented as Strings (we plan to also migrate to the new
numeric type capabilities of Lucene 2.9 at a later time)

For this, the documents will be sorted e.g. according to the author, which
works fine with the new 2.9 sort interface

llSortFields.add(new SortField(strFieldName4Sorting, SortField.STRING, !bAscending));

topDocs =, (Filter) null, m_iMaxTopDocs, new Sort(llSortFields.toArray(new

for (ScoreDoc scoreDoc : m_luceneTopDocs.scoreDocs)
   System.out.println(scoreDoc.score);  //>>>>>> NaN

Nevertheless, we visualize the score of each document inside a birdeye view, to show the relevancy
of each doc according to
the users query. But the scoreDoc.score  numbers have all the value 'NaN'.

This is a new behaviour in Lucene 2.9, I think a good feature to save cpu time - but how can
we get the scores again?



View raw message