public final class JackrabbitIndexReader extends org.apache.lucene.index.FilterIndexReader implements HierarchyResolver, MultiIndexReader
JackrabbitIndexReader
wraps an index reader and
releases
the underlying reader
when a client calls IndexReader.close()
on this reader. This allows reusing
of the underlying index reader instance.Constructor and Description |
---|
JackrabbitIndexReader(org.apache.lucene.index.IndexReader in)
Creates a new
JackrabbitIndexReader . |
Modifier and Type | Method and Description |
---|---|
org.apache.jackrabbit.core.query.lucene.ForeignSegmentDocId |
createDocId(NodeId id)
Creates a document id for the given node identifier.
|
protected void |
doClose()
Calls release on the underlying
MultiIndexReader instead of
closing it. |
int |
getDocumentNumber(org.apache.jackrabbit.core.query.lucene.ForeignSegmentDocId docId)
Returns the document number for the passed
docId . |
org.apache.lucene.index.IndexReader[] |
getIndexReaders() |
int[] |
getParents(int n,
int[] docNumbers)
Returns the document number of the parent of
n or an empty
array if n does not have a parent (n is the
root node). |
org.apache.lucene.index.IndexReader[] |
getSequentialSubReaders() |
void |
release()
Releases this index reader and potentially frees resources.
|
org.apache.lucene.index.TermDocs |
termDocs(org.apache.lucene.index.Term term)
Overwrite
termDocs(Term) and forward the call to the
wrapped reader. |
directory, docFreq, doCommit, document, doDelete, doSetNorm, doUndeleteAll, getCommitUserData, getCoreCacheKey, getDeletesCacheKey, getFieldInfos, getIndexCommit, getTermFreqVector, getTermFreqVector, getTermFreqVector, getTermFreqVectors, getTermInfosIndexDivisor, getUniqueTermCount, getVersion, hasDeletions, hasNorms, isCurrent, isDeleted, isOptimized, maxDoc, norms, norms, numDocs, termDocs, termPositions, terms, terms, toString
acquireWriteLock, addReaderClosedListener, clone, clone, close, commit, commit, decRef, deleteDocument, deleteDocuments, document, doOpenIfChanged, doOpenIfChanged, doOpenIfChanged, doOpenIfChanged, ensureOpen, flush, flush, getCommitUserData, getCurrentVersion, getRefCount, incRef, indexExists, lastModified, listCommits, numDeletedDocs, open, open, open, open, open, open, open, open, open, open, open, openIfChanged, openIfChanged, openIfChanged, openIfChanged, removeReaderClosedListener, reopen, reopen, reopen, reopen, setNorm, setNorm, termPositions, tryIncRef, undeleteAll
public JackrabbitIndexReader(org.apache.lucene.index.IndexReader in)
JackrabbitIndexReader
. The passed index reader
must also implement the interfaces HierarchyResolver
and
MultiIndexReader
.in
- the underlying index reader.IllegalArgumentException
- if in
does not implement
HierarchyResolver
and
MultiIndexReader
.public org.apache.lucene.index.TermDocs termDocs(org.apache.lucene.index.Term term) throws IOException
termDocs(Term)
and forward the call to the
wrapped reader.termDocs
in class org.apache.lucene.index.FilterIndexReader
IOException
protected void doClose() throws IOException
MultiIndexReader
instead of
closing it.doClose
in class org.apache.lucene.index.FilterIndexReader
IOException
- if an error occurs while releaseing the underlying
index reader.public int[] getParents(int n, int[] docNumbers) throws IOException
n
or an empty
array if n
does not have a parent (n
is the
root node).getParents
in interface HierarchyResolver
n
- the document number.docNumbers
- an array for reuse. An implementation should use the
passed array as a container for the return value,
unless the length of the returned array is different
from docNumbers
. In which case an
implementation will create a new array with an
appropriate size.n
's parent.IOException
- if an error occurs while reading from the
index.public org.apache.lucene.index.IndexReader[] getIndexReaders()
getIndexReaders
in interface MultiIndexReader
IndexReader
s that are contained in this
MultiIndexReader
.public org.apache.lucene.index.IndexReader[] getSequentialSubReaders()
getSequentialSubReaders
in class org.apache.lucene.index.FilterIndexReader
public org.apache.jackrabbit.core.query.lucene.ForeignSegmentDocId createDocId(NodeId id) throws IOException
createDocId
in interface MultiIndexReader
id
- the id of the node.null
if there is no node
with the given id
.IOException
- if an error occurs while reading from the index.public int getDocumentNumber(org.apache.jackrabbit.core.query.lucene.ForeignSegmentDocId docId) throws IOException
docId
. If the id
is invalid -1
is returned.getDocumentNumber
in interface MultiIndexReader
docId
- the document id to resolve.-1
if it is invalid (e.g.
does not exist).IOException
- if an error occurs while reading from the index.public void release() throws IOException
IndexReader.close()
this method
does not necessarily close the index reader, but gives the implementation
the opportunity to do reference counting.release
in interface ReleaseableIndexReader
IOException
- if an error occurs while releasing the index reader.Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.