Class UninvertingReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class UninvertingReader
    extends org.apache.lucene.index.FilterLeafReader
    A FilterReader that exposes indexed values as if they also had docvalues.

    This is accomplished by "inverting the inverted index" or "uninversion".

    The uninversion process happens lazily: upon the first request for the field's docvalues (e.g. via LeafReader.getNumericDocValues(String) or similar), it will create the docvalues on-the-fly if needed and cache it, based on the core cache key of the wrapped LeafReader.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  UninvertingReader.FieldCacheStats
      Return information about the backing cache
      static class  UninvertingReader.Type
      Specifies the type of uninversion to apply for the field.
      • Nested classes/interfaces inherited from class org.apache.lucene.index.FilterLeafReader

        org.apache.lucene.index.FilterLeafReader.FilterFields, org.apache.lucene.index.FilterLeafReader.FilterPostingsEnum, org.apache.lucene.index.FilterLeafReader.FilterTerms, org.apache.lucene.index.FilterLeafReader.FilterTermsEnum
      • 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
    • Field Summary

      • Fields inherited from class org.apache.lucene.index.FilterLeafReader

        in
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.lucene.index.BinaryDocValues getBinaryDocValues​(String field)  
      org.apache.lucene.index.IndexReader.CacheHelper getCoreCacheHelper()  
      org.apache.lucene.index.FieldInfos getFieldInfos()  
      org.apache.lucene.index.NumericDocValues getNumericDocValues​(String field)  
      org.apache.lucene.index.IndexReader.CacheHelper getReaderCacheHelper()  
      org.apache.lucene.index.SortedDocValues getSortedDocValues​(String field)  
      org.apache.lucene.index.SortedSetDocValues getSortedSetDocValues​(String field)  
      static UninvertingReader.FieldCacheStats getUninvertedStats()
      Return information about the backing cache
      static int getUninvertedStatsSize()  
      String toString()  
      static org.apache.lucene.index.DirectoryReader wrap​(org.apache.lucene.index.DirectoryReader in, Function<String,​UninvertingReader.Type> mapper)
      Wraps a provided DirectoryReader.
      static org.apache.lucene.index.DirectoryReader wrap​(org.apache.lucene.index.DirectoryReader reader, Map<String,​UninvertingReader.Type> mapping)  
      static org.apache.lucene.index.LeafReader wrap​(org.apache.lucene.index.LeafReader in, Function<String,​UninvertingReader.Type> mapping)
      Create a new UninvertingReader with the specified mapping, wrapped around the input.
      • Methods inherited from class org.apache.lucene.index.FilterLeafReader

        checkIntegrity, doClose, document, getByteVectorValues, getDelegate, getFloatVectorValues, getLiveDocs, getMetaData, getNormValues, getPointValues, getSortedNumericDocValues, getTermVectors, maxDoc, numDocs, searchNearestVectors, searchNearestVectors, storedFields, terms, termVectors, unwrap
      • 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, notifyReaderClosedListeners, numDeletedDocs, registerParentReader, tryIncRef
    • Method Detail

      • wrap

        public static org.apache.lucene.index.DirectoryReader wrap​(org.apache.lucene.index.DirectoryReader in,
                                                                   Function<String,​UninvertingReader.Type> mapper)
                                                            throws IOException
        Wraps a provided DirectoryReader. Note that for convenience, the returned reader can be used normally (e.g. passed to DirectoryReader.openIfChanged(DirectoryReader)) and so on.
        Parameters:
        in - input directory reader
        mapper - function to map a field name to an uninversion type. A Null result means to not uninvert.
        Returns:
        a wrapped directory reader
        Throws:
        IOException
      • wrap

        public static org.apache.lucene.index.LeafReader wrap​(org.apache.lucene.index.LeafReader in,
                                                              Function<String,​UninvertingReader.Type> mapping)
        Create a new UninvertingReader with the specified mapping, wrapped around the input. It may be deemed that there is no mapping to do, in which case the input is returned.

        Expert: This should almost never be used. Use wrap(DirectoryReader, Function) instead.

        NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
      • getFieldInfos

        public org.apache.lucene.index.FieldInfos getFieldInfos()
        Overrides:
        getFieldInfos in class org.apache.lucene.index.FilterLeafReader
      • getNumericDocValues

        public org.apache.lucene.index.NumericDocValues getNumericDocValues​(String field)
                                                                     throws IOException
        Overrides:
        getNumericDocValues in class org.apache.lucene.index.FilterLeafReader
        Throws:
        IOException
      • getBinaryDocValues

        public org.apache.lucene.index.BinaryDocValues getBinaryDocValues​(String field)
                                                                   throws IOException
        Overrides:
        getBinaryDocValues in class org.apache.lucene.index.FilterLeafReader
        Throws:
        IOException
      • getSortedDocValues

        public org.apache.lucene.index.SortedDocValues getSortedDocValues​(String field)
                                                                   throws IOException
        Overrides:
        getSortedDocValues in class org.apache.lucene.index.FilterLeafReader
        Throws:
        IOException
      • getSortedSetDocValues

        public org.apache.lucene.index.SortedSetDocValues getSortedSetDocValues​(String field)
                                                                         throws IOException
        Overrides:
        getSortedSetDocValues in class org.apache.lucene.index.FilterLeafReader
        Throws:
        IOException
      • getCoreCacheHelper

        public org.apache.lucene.index.IndexReader.CacheHelper getCoreCacheHelper()
        Specified by:
        getCoreCacheHelper in class org.apache.lucene.index.LeafReader
      • getReaderCacheHelper

        public org.apache.lucene.index.IndexReader.CacheHelper getReaderCacheHelper()
        Specified by:
        getReaderCacheHelper in class org.apache.lucene.index.IndexReader
      • toString

        public String toString()
        Overrides:
        toString in class org.apache.lucene.index.FilterLeafReader
      • getUninvertedStats

        public static UninvertingReader.FieldCacheStats getUninvertedStats()
        Return information about the backing cache
        NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
      • getUninvertedStatsSize

        public static int getUninvertedStatsSize()