Package org.apache.tika.eval.app.tools
Class SlowCompositeReaderWrapper
java.lang.Object
org.apache.lucene.index.IndexReader
org.apache.lucene.index.LeafReader
org.apache.tika.eval.app.tools.SlowCompositeReaderWrapper
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class SlowCompositeReaderWrapper
extends org.apache.lucene.index.LeafReader
COPIED VERBATIM FROM LUCENE
This class forces a composite reader (eg a
MultiReader
or DirectoryReader
) to emulate a
LeafReader
. This requires implementing the postings
APIs on-the-fly, using the static methods in MultiTerms
, MultiDocValues
, by stepping through
the sub-readers to merge fields/terms, appending docs, etc.
NOTE: this class almost always results in a
performance hit. If this is important to your use case,
you'll get better performance by gathering the sub readers using
IndexReader.getContext()
to get the
leaves and then operate per-LeafReader,
instead of using this class.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
org.apache.lucene.index.IndexReader.CacheHelper, org.apache.lucene.index.IndexReader.CacheKey, org.apache.lucene.index.IndexReader.ClosedListener
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
doClose()
void
document
(int docID, org.apache.lucene.index.StoredFieldVisitor visitor) org.apache.lucene.index.BinaryDocValues
getBinaryDocValues
(String field) org.apache.lucene.index.IndexReader.CacheHelper
org.apache.lucene.index.FieldInfos
org.apache.lucene.util.Bits
org.apache.lucene.index.LeafMetaData
org.apache.lucene.index.NumericDocValues
getNormValues
(String field) org.apache.lucene.index.NumericDocValues
getNumericDocValues
(String field) org.apache.lucene.index.PointValues
getPointValues
(String field) org.apache.lucene.index.IndexReader.CacheHelper
org.apache.lucene.index.SortedDocValues
getSortedDocValues
(String field) org.apache.lucene.index.SortedNumericDocValues
getSortedNumericDocValues
(String field) org.apache.lucene.index.SortedSetDocValues
getSortedSetDocValues
(String field) org.apache.lucene.index.Fields
getTermVectors
(int docID) int
maxDoc()
int
numDocs()
org.apache.lucene.index.Terms
toString()
static org.apache.lucene.index.LeafReader
wrap
(org.apache.lucene.index.IndexReader reader) This method is sugar for getting anLeafReader
from anIndexReader
of any kind.Methods inherited from class org.apache.lucene.index.LeafReader
docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, postings, postings, totalTermFreq
Methods inherited from class org.apache.lucene.index.IndexReader
close, decRef, document, document, ensureOpen, equals, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, registerParentReader, tryIncRef
-
Method Details
-
wrap
public static org.apache.lucene.index.LeafReader wrap(org.apache.lucene.index.IndexReader reader) throws IOException This method is sugar for getting anLeafReader
from anIndexReader
of any kind. If the reader is already atomic, it is returned unchanged, otherwise wrapped by this class.- Throws:
IOException
-
toString
-
getReaderCacheHelper
public org.apache.lucene.index.IndexReader.CacheHelper getReaderCacheHelper()- Specified by:
getReaderCacheHelper
in classorg.apache.lucene.index.IndexReader
-
getCoreCacheHelper
public org.apache.lucene.index.IndexReader.CacheHelper getCoreCacheHelper()- Specified by:
getCoreCacheHelper
in classorg.apache.lucene.index.LeafReader
-
terms
- Specified by:
terms
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getNumericDocValues
public org.apache.lucene.index.NumericDocValues getNumericDocValues(String field) throws IOException - Specified by:
getNumericDocValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getBinaryDocValues
- Specified by:
getBinaryDocValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getSortedNumericDocValues
public org.apache.lucene.index.SortedNumericDocValues getSortedNumericDocValues(String field) throws IOException - Specified by:
getSortedNumericDocValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getSortedDocValues
- Specified by:
getSortedDocValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getSortedSetDocValues
public org.apache.lucene.index.SortedSetDocValues getSortedSetDocValues(String field) throws IOException - Specified by:
getSortedSetDocValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getNormValues
- Specified by:
getNormValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getTermVectors
- Specified by:
getTermVectors
in classorg.apache.lucene.index.IndexReader
- Throws:
IOException
-
numDocs
public int numDocs()- Specified by:
numDocs
in classorg.apache.lucene.index.IndexReader
-
maxDoc
public int maxDoc()- Specified by:
maxDoc
in classorg.apache.lucene.index.IndexReader
-
document
public void document(int docID, org.apache.lucene.index.StoredFieldVisitor visitor) throws IOException - Specified by:
document
in classorg.apache.lucene.index.IndexReader
- Throws:
IOException
-
getLiveDocs
public org.apache.lucene.util.Bits getLiveDocs()- Specified by:
getLiveDocs
in classorg.apache.lucene.index.LeafReader
-
getPointValues
- Specified by:
getPointValues
in classorg.apache.lucene.index.LeafReader
-
getFieldInfos
public org.apache.lucene.index.FieldInfos getFieldInfos()- Specified by:
getFieldInfos
in classorg.apache.lucene.index.LeafReader
-
doClose
- Specified by:
doClose
in classorg.apache.lucene.index.IndexReader
- Throws:
IOException
-
checkIntegrity
- Specified by:
checkIntegrity
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getMetaData
public org.apache.lucene.index.LeafMetaData getMetaData()- Specified by:
getMetaData
in classorg.apache.lucene.index.LeafReader
-