org.apache.lucene.codecs

## Class PostingsReaderBase

- java.lang.Object
- - org.apache.lucene.codecs.PostingsReaderBase

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

      public abstract class PostingsReaderBase
      extends Object
      implements Closeable, Accountable

  The core terms dictionaries (BlockTermsReader, BlockTreeTermsReader) interact with a single instance of this class to manage creation of `PostingsEnum` and `PostingsEnum` instances. It provides an IndexInput (termsIn) where this class may read any previously stored data that it had written in its corresponding `PostingsWriterBase` at indexing time.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `PostingsReaderBase()` Sole constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `checkIntegrity()` Checks consistency of this reader.
    `abstract void` | `close()`
    `abstract void` | `decodeTerm(long[] longs, DataInput in, FieldInfo fieldInfo, BlockTermState state, boolean absolute)` Actually decode metadata for next term
    `abstract void` | `init(IndexInput termsIn, SegmentReadState state)` Performs any initialization, such as reading and verifying the header from the provided terms dictionary `IndexInput`.
    `abstract BlockTermState` | `newTermState()` Return a newly created empty TermState
    `abstract PostingsEnum` | `postings(FieldInfo fieldInfo, BlockTermState state, PostingsEnum reuse, int flags)` Must fully consume state, since after this call that TermState may be reused.

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

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

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

      `getChildResources, ramBytesUsed`

- - ### Constructor Detail

    - #### PostingsReaderBase

          protected PostingsReaderBase()

      Sole constructor. (For invocation by subclass constructors, typically implicit.)

  - ### Method Detail

    - #### init

          public abstract void init(IndexInput termsIn,
                                    SegmentReadState state)
                             throws IOException

      Performs any initialization, such as reading and verifying the header from the provided terms dictionary `IndexInput`.
      Throws:
        `IOException`

    - #### newTermState

          public abstract BlockTermState newTermState()
                                               throws IOException

      Return a newly created empty TermState
      Throws:
        `IOException`

    - #### decodeTerm

          public abstract void decodeTerm(long[] longs,
                                          DataInput in,
                                          FieldInfo fieldInfo,
                                          BlockTermState state,
                                          boolean absolute)
                                   throws IOException

      Actually decode metadata for next term
      Throws:
        `IOException`
      See Also:
        `PostingsWriterBase.encodeTerm(long[], org.apache.lucene.store.DataOutput, org.apache.lucene.index.FieldInfo, org.apache.lucene.codecs.BlockTermState, boolean)`

    - #### postings

          public abstract PostingsEnum postings(FieldInfo fieldInfo,
                                                BlockTermState state,
                                                PostingsEnum reuse,
                                                int flags)
                                         throws IOException

      Must fully consume state, since after this call that TermState may be reused.
      Throws:
        `IOException`

    - #### checkIntegrity

          public abstract void checkIntegrity()
                                       throws IOException

      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.

      Throws:
        `IOException`
      NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

    - #### close

          public abstract void close()
                              throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

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