lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject RE: Hard to customize sort method in IndexSearcher via HitCollect or
Date Thu, 28 Feb 2002 16:22:47 GMT
> From: Che Dong []
> 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:

> 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.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message