yes, I've been thinking about those caches and how they might be used for range searches ... I hadn't been able to spend enough time to figure out how it might look, though - thanks for the ideas.
I'm willing to take a look at it next week - I won't have time before then ... Tim > -----Original Message----- > From: Doug Cutting [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 11, 2004 2:18 PM > To: Lucene Developers List > Subject: sort & range stuff > > > 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? > > Doug --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]