lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan McKinley (JIRA)" <>
Subject [jira] Commented: (LUCENE-2649) FieldCache should include a BitSet for matching docs
Date Thu, 23 Sep 2010 18:55:35 GMT


Ryan McKinley commented on LUCENE-2649:

Ok, as I look more, I think it may be worth some even bigger changes!  

Is there any advantage to having a different map for each Type?  The double (and triple) cache
can get a bit crazy and lead to so much duplication

What about moving to a FieldCache that is centered around the very basic API:

public <T> T get(IndexReader reader, String field, EntryCreator<T> creator)

Entry creator would be something like
public abstract static class EntryCreator<T> implements Serializable 
    public abstract T create( IndexReader reader, String field );
    public abstract void validate( T entry, IndexReader reader, String field );
     * NOTE: the hashCode is used as part of the cache Key, so make sure it 
     * only changes if you want different entries for the same field
    public int hashCode()
      return EntryCreator.class.hashCode();

We could add all the utility functions that cast stuff to ByteValues etc.  We would also make
sure that the Map does not use the EntryCreator as a key, but uses it to generate a key.

A sample EntryCreator would look like this:

class BytesEntryCreator extends FieldCache.EntryCreator<ByteValues> {

  public ByteValues create(IndexReader reader, String field) 
    // all the normal walking stuff using whatever parameters we have specified

  public void validate(ByteValues entry, IndexReader reader, String field) 
    // all the normal walking stuff using whatever parameters we have specified

Thoughts on this approach?  

Crazy how a seemingly simple issue just explodes :(

> FieldCache should include a BitSet for matching docs
> ----------------------------------------------------
>                 Key: LUCENE-2649
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Ryan McKinley
>             Fix For: 4.0
>         Attachments: LUCENE-2649-FieldCacheWithBitSet.patch, LUCENE-2649-FieldCacheWithBitSet.patch,
LUCENE-2649-FieldCacheWithBitSet.patch, LUCENE-2649-FieldCacheWithBitSet.patch, LUCENE-2649-FieldCacheWithBitSet.patch
> The FieldCache returns an array representing the values for each doc.  However there
is no way to know if the doc actually has a value.
> This should be changed to return an object representing the values *and* a BitSet for
all valid docs.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

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

View raw message