On Sep 18, 2005, at 10:24 AM, James Huang wrote:
> --- Erik Hatcher <erik@ehatchersolutions.com> wrote:
>
>
>> Get back to using your DistanceComparatorSource, and
>> couple that with
>> a SortField.FIELD_SCORE, like this:
>>
>> Sort sort = new Sort(new SortField[] {new
>> SortField("location",
>> new DistanceComparatorSource(<whatever args
>> you need>)),
>> SortField.FIELD_SCORE});
>>
>
> Thanks!
>
> Does the order of thest two fields matter? I mean,
> with your code, would distance take precedence over
> relevance? Anyway, I'll try it out and play with
> ordering and such.
Yes, order matters - they sort in the order specified. Subsequent
SortField's in the list are only used when prior ones are
equivalent. In other words, when the distance is equal between two
documents, then they are sorted by score.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
|