lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Keegan" <peterlkee...@gmail.com>
Subject Re: Sorting by Score
Date Tue, 27 Feb 2007 20:52:02 GMT
Suppose one wanted to use this custom rounding score comparator on all
fields and all queries. How would you get it plugged in most efficiently,
given that SortField requires a non-null field name?

Peter

On 2/1/06, Chris Hostetter <hossman_lucene@fucit.org> wrote:
>
>
> : I've not used the sorting code yet, but it looks like you have to
> : provide some custom ScoreDocComparator by adding a SortField using the
> : SortField(String field, SortComparatorSource comparator) constructor.
> : I'm just not certain what you should specify for the field value since
> : you really want to just round off the score.
> :
> : Could someone with more experience using the Sort API clarify whether
> : this is possible?
>
> yes, it should be possible, and yes your description of a solution sounds
> right ... the only odd thing is you'd be writting a
> SortComparatorSource/ScoreDocComparator that would be ignoring the field
> it's given, but there's nothing wrong with that.
>
> Round your number to the desired precision, then compare them, and return
> 0 if they are equal so that the secondary sort (on date in this case) can
> take affect.
>
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> 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