lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: question about ScoreDocComparator
Date Sun, 04 Mar 2007 23:05:05 GMT
Maybe I'm missing something in turn, but why not just use a Sort object at
search time?  You can have a Hits object or TopFIeldDocs object returned
(the Filter in some of these calls can be null).

Best
Erick


On 3/1/07, Ulf Dittmer <ulf@ulfdittmer.com> wrote:
>
> Hello-
>
> 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
> here.
>
> 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,
> Ulf
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message