org.apache.lucene.index

## Class FilterCodecReader

- java.lang.Object
- - org.apache.lucene.index.IndexReader
  - - org.apache.lucene.index.LeafReader
    - - org.apache.lucene.index.CodecReader
      - - org.apache.lucene.index.FilterCodecReader

- All Implemented Interfaces:
    Closeable, AutoCloseable, Accountable
  Direct Known Subclasses:
    SortingCodecReader

      public abstract class FilterCodecReader
      extends CodecReader

  A `FilterCodecReader` contains another CodecReader, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.

  NOTE: If this `FilterCodecReader` does not change the content the contained reader, you could consider delegating calls to `LeafReader.getCoreCacheHelper()` and `IndexReader.getReaderCacheHelper()`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader

      `IndexReader.CacheHelper, IndexReader.CacheKey, IndexReader.ClosedListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CodecReader` | `in` The underlying CodecReader instance.

    - ### Fields inherited from interface org.apache.lucene.util.Accountable

      `NULL_ACCOUNTABLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FilterCodecReader(CodecReader in)` Creates a new FilterCodecReader.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkIntegrity()` Checks consistency of this reader.
    `protected void` | `doClose()` Implements close.
    `Collection<Accountable>` | `getChildResources()` Returns nested resources of this class.
    `CodecReader` | `getDelegate()` Returns the wrapped `CodecReader`.
    `DocValuesProducer` | `getDocValuesReader()` Expert: retrieve underlying DocValuesProducer
    `FieldInfos` | `getFieldInfos()` Get the `FieldInfos` describing all fields in this reader.
    `StoredFieldsReader` | `getFieldsReader()` Expert: retrieve thread-private StoredFieldsReader
    `Bits` | `getLiveDocs()` Returns the `Bits` representing live (not deleted) docs.
    `LeafMetaData` | `getMetaData()` Return metadata about this leaf.
    `NormsProducer` | `getNormsReader()` Expert: retrieve underlying NormsProducer
    `PointsReader` | `getPointsReader()` Expert: retrieve underlying PointsReader
    `FieldsProducer` | `getPostingsReader()` Expert: retrieve underlying FieldsProducer
    `TermVectorsReader` | `getTermVectorsReader()` Expert: retrieve thread-private TermVectorsReader
    `int` | `maxDoc()` Returns one greater than the largest possible document number.
    `int` | `numDocs()` Returns the number of documents in this index.
    `long` | `ramBytesUsed()` Return the memory usage of this object in bytes.
    `static CodecReader` | `unwrap(CodecReader reader)` Get the wrapped instance by `reader` as long as this reader is an instance of `FilterCodecReader`.

    - ### Methods inherited from class org.apache.lucene.index.CodecReader

      `document, getBinaryDocValues, getNormValues, getNumericDocValues, getPointValues, getSortedDocValues, getSortedNumericDocValues, getSortedSetDocValues, getTermVectors, terms`

    - ### Methods inherited from class org.apache.lucene.index.LeafReader

      `docFreq, getContext, getCoreCacheHelper, getDocCount, getSumDocFreq, getSumTotalTermFreq, postings, postings, totalTermFreq`

    - ### Methods inherited from class org.apache.lucene.index.IndexReader

      `close, decRef, document, document, ensureOpen, equals, getReaderCacheHelper, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, registerParentReader, tryIncRef`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### in

          protected final CodecReader in

      The underlying CodecReader instance.

  - ### Constructor Detail

    - #### FilterCodecReader

          public FilterCodecReader(CodecReader in)

      Creates a new FilterCodecReader.
      Parameters:
        `in` - the underlying CodecReader instance.

  - ### Method Detail

    - #### unwrap

          public static CodecReader unwrap(CodecReader reader)

      Get the wrapped instance by `reader` as long as this reader is an instance of `FilterCodecReader`.

    - #### getFieldsReader

          public StoredFieldsReader getFieldsReader()

      Description copied from class: `CodecReader`
      Expert: retrieve thread-private StoredFieldsReader
      Specified by:
        `getFieldsReader` in class `CodecReader`

    - #### getTermVectorsReader

          public TermVectorsReader getTermVectorsReader()

      Description copied from class: `CodecReader`
      Expert: retrieve thread-private TermVectorsReader
      Specified by:
        `getTermVectorsReader` in class `CodecReader`

    - #### getNormsReader

          public NormsProducer getNormsReader()

      Description copied from class: `CodecReader`
      Expert: retrieve underlying NormsProducer
      Specified by:
        `getNormsReader` in class `CodecReader`

    - #### getDocValuesReader

          public DocValuesProducer getDocValuesReader()

      Description copied from class: `CodecReader`
      Expert: retrieve underlying DocValuesProducer
      Specified by:
        `getDocValuesReader` in class `CodecReader`

    - #### getPostingsReader

          public FieldsProducer getPostingsReader()

      Description copied from class: `CodecReader`
      Expert: retrieve underlying FieldsProducer
      Specified by:
        `getPostingsReader` in class `CodecReader`

    - #### getLiveDocs

          public Bits getLiveDocs()

      Description copied from class: `LeafReader`
      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 `LeafReader`

    - #### getFieldInfos

          public FieldInfos getFieldInfos()

      Description copied from class: `LeafReader`
      Get the `FieldInfos` describing all fields in this reader. Note: Implementations should cache the FieldInfos instance returned by this method such that subsequent calls to this method return the same instance.
      Specified by:
        `getFieldInfos` in class `LeafReader`

    - #### getPointsReader

          public PointsReader getPointsReader()

      Description copied from class: `CodecReader`
      Expert: retrieve underlying PointsReader
      Specified by:
        `getPointsReader` in class `CodecReader`

    - #### numDocs

          public int numDocs()

      Description copied from class: `IndexReader`
      Returns the number of documents in this index.

      NOTE: This operation may run in O(maxDoc). Implementations that can't return this number in constant-time should cache it.

      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`

    - #### getMetaData

          public LeafMetaData getMetaData()

      Description copied from class: `LeafReader`
      Return metadata about this leaf.
      Specified by:
        `getMetaData` in class `LeafReader`

    - #### doClose

          protected void doClose()
                          throws IOException

      Description copied from class: `IndexReader`
      Implements close.
      Overrides:
        `doClose` in class `CodecReader`
      Throws:
        `IOException`

    - #### ramBytesUsed

          public long ramBytesUsed()

      Description copied from interface: `Accountable`
      Return the memory usage of this object in bytes. Negative values are illegal.
      Specified by:
        `ramBytesUsed` in interface `Accountable`
      Overrides:
        `ramBytesUsed` in class `CodecReader`

    - #### getChildResources

          public Collection<Accountable> getChildResources()

      Description copied from interface: `Accountable`
      Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).
      Specified by:
        `getChildResources` in interface `Accountable`
      Overrides:
        `getChildResources` in class `CodecReader`
      See Also:
        `Accountables`

    - #### checkIntegrity

          public void checkIntegrity()
                              throws IOException

      Description copied from class: `LeafReader`
      Checks consistency of this reader.

      Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value against large data files.

      Overrides:
        `checkIntegrity` in class `CodecReader`
      Throws:
        `IOException`

    - #### getDelegate

          public CodecReader getDelegate()

      Returns the wrapped `CodecReader`.

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.