lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject sort & range stuff
Date Tue, 11 May 2004 19:18:04 GMT
Tim Jones wrote:
> I've got a couple of fixes to put in the sorting stuff,
> but they can be put in after RC3 ...

One change I'd like to see in the sort code is the lastReaderHash stuff 
replaced with a static WeakHashMap, mapping from IndexReader to 
fieldCache hash tables.  Right now the sort code will be very slow if 
used alternately on several indexes, which is not uncommon in 
applications.  Also, I don't think the cache code is thread safe.

Also, we should expose the cache through a public API, so that folks can 
use it to, e.g., efficiently implement range search from a HitCollector. 
  This might through methods like:

public int[] FieldCache.getInts(IndexReader reader, String field);
public float[] FieldCache.getFloats(IndexReader reader, String field);
public long[] FieldCache.getDates(IndexReader reader, String field);
public String[] FieldCache.getStrings(IndexReader reader, String field);

If we then changed the Filter API to be something like:

   public interface Filter {
     IndexFilter getIndexFilter(IndexReader reader);

   public interface IndexFilter {
     boolean includeDocument(int number);

Then we could implement efficient filters like:

    IntRangeFilter(String fieldName, int start, int end);
    FloatRangeFilter(String fieldName, float start, int end);
    DateRangeFilter(String fieldName, Date start, Date end);
    StringRangeFilter(String fieldName, String start, String end);

These would be really easy to implement, given the cache.

Tim, do you have time and interest to work on this?


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

View raw message