lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulf Dittmer <>
Subject question about ScoreDocComparator
Date Thu, 01 Mar 2007 14:43:45 GMT

One of the fields in my index is an ID, which maps to a full text  
description behind the scenes. Now I want to sort the search results  
alphabetically according to the description, not the ID. This can be  
done via SortComparatorSource and a ScoreDocComparator without  
problems. But the code needed to do this is quite complicated - it  
involves retrieving the document ID from the ScoreDoc, then looking  
up the Document through an IndexReader, and then retrieving the ID  
field from the document. It seems that there should be an easier way  
to get at the ID field, since that is the one being used for the  
sort. There is a related class FieldDoc, through which it seems  
possible to get at the field values, but that doesn't seem applicable  

I went through the custom sorting example of "Lucene In Action", but  
that doesn't deal with this case. Am I missing something obvious?

Thanks in advance,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message