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 aMultiReader
orDirectoryReader
) to emulate aLeafReader
. This requires implementing the postings APIs on-the-fly, using the static methods inMultiTerms
,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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIntegrity()
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.ByteVectorValues
getByteVectorValues(String s)
org.apache.lucene.index.IndexReader.CacheHelper
getCoreCacheHelper()
org.apache.lucene.index.FieldInfos
getFieldInfos()
org.apache.lucene.index.FloatVectorValues
getFloatVectorValues(String s)
org.apache.lucene.util.Bits
getLiveDocs()
org.apache.lucene.index.LeafMetaData
getMetaData()
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
getReaderCacheHelper()
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()
void
searchNearestVectors(String string, byte[] bytes, org.apache.lucene.search.KnnCollector kc, org.apache.lucene.util.Bits bits)
void
searchNearestVectors(String string, float[] floats, org.apache.lucene.search.KnnCollector kc, org.apache.lucene.util.Bits bits)
org.apache.lucene.index.StoredFields
storedFields()
org.apache.lucene.index.Terms
terms(String field)
org.apache.lucene.index.TermVectors
termVectors()
String
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, searchNearestVectors, searchNearestVectors, totalTermFreq
-
-
-
-
Method Detail
-
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
-
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
public org.apache.lucene.index.Terms terms(String field) throws IOException
- 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
public org.apache.lucene.index.BinaryDocValues getBinaryDocValues(String field) throws IOException
- 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
public org.apache.lucene.index.SortedDocValues getSortedDocValues(String field) throws IOException
- 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
public org.apache.lucene.index.NumericDocValues getNormValues(String field) throws IOException
- Specified by:
getNormValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getFloatVectorValues
public org.apache.lucene.index.FloatVectorValues getFloatVectorValues(String s) throws IOException
- Specified by:
getFloatVectorValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getByteVectorValues
public org.apache.lucene.index.ByteVectorValues getByteVectorValues(String s) throws IOException
- Specified by:
getByteVectorValues
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
searchNearestVectors
public void searchNearestVectors(String string, float[] floats, org.apache.lucene.search.KnnCollector kc, org.apache.lucene.util.Bits bits) throws IOException
- Specified by:
searchNearestVectors
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
searchNearestVectors
public void searchNearestVectors(String string, byte[] bytes, org.apache.lucene.search.KnnCollector kc, org.apache.lucene.util.Bits bits) throws IOException
- Specified by:
searchNearestVectors
in classorg.apache.lucene.index.LeafReader
- Throws:
IOException
-
getTermVectors
public org.apache.lucene.index.Fields getTermVectors(int docID) throws IOException
- Specified by:
getTermVectors
in classorg.apache.lucene.index.IndexReader
- Throws:
IOException
-
termVectors
public org.apache.lucene.index.TermVectors termVectors() throws IOException
- Specified by:
termVectors
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
-
storedFields
public org.apache.lucene.index.StoredFields storedFields() throws IOException
- Specified by:
storedFields
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
public org.apache.lucene.index.PointValues getPointValues(String field)
- 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
protected void doClose() throws IOException
- Specified by:
doClose
in classorg.apache.lucene.index.IndexReader
- Throws:
IOException
-
checkIntegrity
public void checkIntegrity() throws IOException
- 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
-
-