org.apache.jackrabbit.core.query.lucene
Class CachingMultiReader

java.lang.Object
  extended byorg.apache.lucene.index.IndexReader
      extended byorg.apache.lucene.index.MultiReader
          extended byorg.apache.jackrabbit.core.query.lucene.CachingMultiReader
All Implemented Interfaces:
HierarchyResolver

public final class CachingMultiReader
extends org.apache.lucene.index.MultiReader
implements HierarchyResolver

Extends a MultiReader with support for cached TermDocs on FieldNames.UUID field.


Constructor Summary
CachingMultiReader(org.apache.jackrabbit.core.query.lucene.ReadOnlyIndexReader[] subReaders, org.apache.jackrabbit.core.query.lucene.DocNumberCache cache)
          Creates a new CachingMultiReader based on sub readers.
 
Method Summary
protected  void doClose()
          Decrements the reference count and closes the underlying readers if this reader is not in use anymore.
 int getParent(int n)
          Returns the document number of the parent of n or -1 if n does not have a parent (n is the root node).
 org.apache.jackrabbit.core.query.lucene.DocId getParentDocId(int n)
          Returns the DocId of the parent of n or DocId#NULL if n does not have a parent (n is the root node).
 org.apache.lucene.index.TermDocs termDocs(org.apache.lucene.index.Term term)
          
 
Methods inherited from class org.apache.lucene.index.MultiReader
docFreq, doCommit, document, doDelete, doSetNorm, doUndeleteAll, getFieldNames, getFieldNames, getIndexedFieldNames, getTermFreqVector, getTermFreqVectors, hasDeletions, isDeleted, maxDoc, norms, norms, numDocs, termDocs, termPositions, terms, terms
 
Methods inherited from class org.apache.lucene.index.IndexReader
close, commit, delete, delete, directory, finalize, getCurrentVersion, getCurrentVersion, getCurrentVersion, indexExists, indexExists, indexExists, isLocked, isLocked, lastModified, lastModified, lastModified, open, open, open, setNorm, setNorm, termPositions, undeleteAll, unlock
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingMultiReader

public CachingMultiReader(org.apache.jackrabbit.core.query.lucene.ReadOnlyIndexReader[] subReaders,
                          org.apache.jackrabbit.core.query.lucene.DocNumberCache cache)
                   throws IOException
Creates a new CachingMultiReader based on sub readers.

Parameters:
subReaders - the sub readers.
cache - the document number cache.
Throws:
IOException - if an error occurs while reading from the indexes.
Method Detail

getParent

public final int getParent(int n)
                    throws IOException
Returns the document number of the parent of n or -1 if n does not have a parent (n is the root node).

Specified by:
getParent in interface HierarchyResolver
Parameters:
n - the document number.
Returns:
the document number of n's parent.
Throws:
IOException - if an error occurs while reading from the index.

getParentDocId

public final org.apache.jackrabbit.core.query.lucene.DocId getParentDocId(int n)
                                                                   throws IOException
Returns the DocId of the parent of n or DocId#NULL if n does not have a parent (n is the root node).

Parameters:
n - the document number.
Returns:
the DocId of n's parent.
Throws:
IOException - if an error occurs while reading from the index.

termDocs

public org.apache.lucene.index.TermDocs termDocs(org.apache.lucene.index.Term term)
                                          throws IOException

Throws:
IOException

doClose

protected void doClose()
                throws IOException
Decrements the reference count and closes the underlying readers if this reader is not in use anymore.

Throws:
IOException - if an error occurs while closing this reader.


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.