Class FilterAtomicReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    SortingAtomicReader

    public class FilterAtomicReader
    extends AtomicReader
    A FilterAtomicReader contains another AtomicReader, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The class FilterAtomicReader itself simply implements all abstract methods of IndexReader with versions that pass all requests to the contained index reader. Subclasses of FilterAtomicReader may further override some of these methods and may also provide additional methods and fields.

    NOTE: If you override getLiveDocs(), you will likely need to override numDocs() as well and vice-versa.

    NOTE: If this FilterAtomicReader does not change the content the contained reader, you could consider overriding IndexReader.getCoreCacheKey() so that FieldCache and CachingWrapperFilter share the same entries for this atomic reader and the wrapped one. IndexReader.getCombinedCoreAndDeletesKey() could be overridden as well if the live docs are not changed either.

    • Constructor Detail

      • FilterAtomicReader

        public FilterAtomicReader​(AtomicReader in)

        Construct a FilterAtomicReader based on the specified base reader.

        Note that base reader is closed if this FilterAtomicReader is closed.

        Parameters:
        in - specified base reader.
    • Method Detail

      • getLiveDocs

        public Bits getLiveDocs()
        Description copied from class: AtomicReader
        Returns the Bits representing live (not deleted) docs. A set bit indicates the doc ID has not been deleted. If this method returns null it means there are no deleted documents (all documents are live). The returned instance has been safely published for use by multiple threads without additional synchronization.
        Specified by:
        getLiveDocs in class AtomicReader
      • getTermVectors

        public Fields getTermVectors​(int docID)
                              throws java.io.IOException
        Description copied from class: IndexReader
        Retrieve term vectors for this document, or null if term vectors were not indexed. The returned Fields instance acts like a single-document inverted index (the docID will be 0).
        Specified by:
        getTermVectors in class IndexReader
        Throws:
        java.io.IOException
      • numDocs

        public int numDocs()
        Description copied from class: IndexReader
        Returns the number of documents in this index.
        Specified by:
        numDocs in class IndexReader
      • maxDoc

        public int maxDoc()
        Description copied from class: IndexReader
        Returns one greater than the largest possible document number. This may be used to, e.g., determine how big to allocate an array which will have an element for every document number in an index.
        Specified by:
        maxDoc in class IndexReader
      • fields

        public Fields fields()
                      throws java.io.IOException
        Description copied from class: AtomicReader
        Returns Fields for this reader. This method may return null if the reader has no postings.
        Specified by:
        fields in class AtomicReader
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getDocsWithField

        public Bits getDocsWithField​(java.lang.String field)
                              throws java.io.IOException
        Description copied from class: AtomicReader
        Returns a Bits at the size of reader.maxDoc(), with turned on bits for each docid that does have a value for this field, or null if no DocValues were indexed for this field. The returned instance should only be used by a single thread
        Specified by:
        getDocsWithField in class AtomicReader
        Throws:
        java.io.IOException