lucene-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/LUCENE-2649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12914163#action_12914163
] 

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:

{code:java}
public <T> T get(IndexReader reader, String field, EntryCreator<T> creator)
{code}

Entry creator would be something like
{code:java}
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
     */
    @Override
    public int hashCode()
    {
      return EntryCreator.class.hashCode();
    }
  }
{code}

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:
{code:java}

class BytesEntryCreator extends FieldCache.EntryCreator<ByteValues> {

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

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

Thoughts on this approach?  


Crazy how a seemingly simple issue just explodes :(

> FieldCache should include a BitSet for matching docs
> ----------------------------------------------------
>
>                 Key: LUCENE-2649
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2649
>             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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message