lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ype Kingma <ykin...@xs4all.nl>
Subject Re: How to implement Similarity for custom sorting by field ( or by docID)?
Date Wed, 16 Jul 2003 05:14:01 GMT
On Tuesday 15 July 2003 02:03, Che Dong wrote:
> Hi All:
> In lucene 1.3 rc1 release included a Similarity for custom scoring. Is it
> possible implement a docID based or (some field value based )scoring beside
> DefautlSimilarity?

Similarity is based on things that can be found in the index, and not on
things that are obtained by retrieving stored fields of documents.
In general, retrieving stored values during search is bad for search 
performance.

When you want to sort by docId you could:
- first collect all document numbers matching the query,
  evt. raise an exception when there are too many hits,
- then retrieve all documents in document nr order,
  together with the docId stored field values.
  (iirc you also get documents in doc nr order when you
  use your own results collector.)
- finally sort your results by retrieved docId.

Since one normally needs to retrieve some stored fields
anyway, this doesn't hurt performance.

Kind regards,
Ype Kingma


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message