lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <DCutt...@grandcentral.com>
Subject RE: Hard to customize sort method in IndexSearcher via HitCollect or
Date Thu, 28 Feb 2002 16:22:47 GMT
> From: Che Dong [mailto:chedong@yahoo.com]
> 
> here is example for sort result with score multi by rank field;
> 
> scorer.score(new HitCollector() {
>  public final void collect(int doc, float score) {
>  [ ... ] 
>      String rank = reader.doc(doc).getField("rank").stringValue();

The problem is that a call to getField() makes searches an order of
magnitude slower.  Doing this efficiently is possible, but requires more
than what you present.  For more information, see:
  http://www.mail-archive.com/lucene-user@jakarta.apache.org/msg00825.html

> I think if Search have a abstract layer for Sorter and use 
> Searcher like
> search(Query,Filter,Sorter) will make lucene convenience for more
> applications.

This would be great, if done efficiently.  Unfortunately, any interface
which sorts Document objects is bound to be slow.  One could devise an API
that sorts hits by the value of a field.  It would need to cache all of the
values of that field so that they could be efficiently randomly accessed.  I
would welcome such a contribution.

Doug

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message