org.apache.lucene.codecs.uniformsplit

## Class DeltaBaseTermStateSerializer

- java.lang.Object
- - org.apache.lucene.codecs.uniformsplit.DeltaBaseTermStateSerializer

- All Implemented Interfaces:
    Accountable

      public class DeltaBaseTermStateSerializer
      extends Object
      implements Accountable

  `TermState` serializer which encodes each file pointer as a delta relative to a base file pointer. It differs from `Lucene50PostingsWriter.encodeTerm(long[], org.apache.lucene.store.DataOutput, org.apache.lucene.index.FieldInfo, org.apache.lucene.codecs.BlockTermState, boolean)` which encodes each file pointer as a delta relative to the previous file pointer.

  It automatically sets the base file pointer to the first valid file pointer for doc start FP, pos start FP, pay start FP. These base file pointers have to be `reset` by the caller before starting to write a new block.

  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `baseDocStartFP`
    `protected long` | `basePayStartFP`
    `protected long` | `basePosStartFP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeltaBaseTermStateSerializer()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getBaseDocStartFP()`
    `long` | `getBasePayStartFP()`
    `long` | `getBasePosStartFP()`
    `long` | `ramBytesUsed()`
    `static long` | `ramBytesUsed(TermState termState)`
    `BlockTermState` | `readTermState(long baseDocStartFP, long basePosStartFP, long basePayStartFP, DataInput termStatesInput, FieldInfo fieldInfo, BlockTermState reuse)` Reads a `BlockTermState` from the provided `DataInput`.
    `protected Lucene50PostingsFormat.IntBlockTermState` | `reset(Lucene50PostingsFormat.IntBlockTermState termState)`
    `void` | `resetBaseStartFP()` Resets the base file pointers to 0.
    `void` | `writeTermState(DataOutput termStatesOutput, FieldInfo fieldInfo, BlockTermState termState)` Writes a `BlockTermState` to the provided `DataOutput`.

    - ### 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`

- - ### Field Detail

    - #### baseDocStartFP

          protected long baseDocStartFP

    - #### basePosStartFP

          protected long basePosStartFP

    - #### basePayStartFP

          protected long basePayStartFP

  - ### Constructor Detail

    - #### DeltaBaseTermStateSerializer

          public DeltaBaseTermStateSerializer()

  - ### Method Detail

    - #### resetBaseStartFP

          public void resetBaseStartFP()

      Resets the base file pointers to 0. This method has to be called before starting to write a new block.

    - #### getBaseDocStartFP

          public long getBaseDocStartFP()

      Returns:
        The base doc start file pointer. It is the file pointer of the first `TermState` written after `resetBaseStartFP()` is called.

    - #### getBasePosStartFP

          public long getBasePosStartFP()

      Returns:
        The base position start file pointer. It is the file pointer of the first `TermState` written after `resetBaseStartFP()` is called.

    - #### getBasePayStartFP

          public long getBasePayStartFP()

      Returns:
        The base payload start file pointer. It is the file pointer of the first `TermState` written after `resetBaseStartFP()` is called.

    - #### writeTermState

          public void writeTermState(DataOutput termStatesOutput,
                                     FieldInfo fieldInfo,
                                     BlockTermState termState)
                              throws IOException

      Writes a `BlockTermState` to the provided `DataOutput`.

      Simpler variant of `Lucene50PostingsWriter.encodeTerm(long[], DataOutput, FieldInfo, BlockTermState, boolean)`.

      Throws:
        `IOException`

    - #### readTermState

          public BlockTermState readTermState(long baseDocStartFP,
                                              long basePosStartFP,
                                              long basePayStartFP,
                                              DataInput termStatesInput,
                                              FieldInfo fieldInfo,
                                              BlockTermState reuse)
                                       throws IOException

      Reads a `BlockTermState` from the provided `DataInput`.

      Simpler variant of `Lucene50PostingsReader.decodeTerm(long[], DataInput, FieldInfo, BlockTermState, boolean)`.

      Parameters:
        `reuse` - `BlockTermState` to reuse; or null to create a new one.
      Throws:
        `IOException`

    - #### reset

          protected Lucene50PostingsFormat.IntBlockTermState reset(Lucene50PostingsFormat.IntBlockTermState termState)

    - #### ramBytesUsed

          public long ramBytesUsed()

      Specified by:
        `ramBytesUsed` in interface `Accountable`

    - #### ramBytesUsed

          public static long ramBytesUsed(TermState termState)

      Returns:
        The estimated RAM usage of the given `TermState`.

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