org.apache.lucene.codecs.uniformsplit

## Class FSTDictionary

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

- All Implemented Interfaces:
    IndexDictionary, Accountable

      public class FSTDictionary
      extends Object
      implements IndexDictionary

  Immutable stateless `FST`-based index dictionary kept in memory.

  Use `IndexDictionary.Builder` to build the `IndexDictionary`.

  Create a stateful `IndexDictionary.Browser` to seek a term in this `IndexDictionary` and get its corresponding block file pointer to the terms block file.

  Its greatest advantage is to be very compact in memory thanks to both the compaction of the `FST` as a byte array, and the incremental encoding of the leaves block pointer values, which are long integers in increasing order, with `PositiveIntOutputs`.
  With a compact dictionary in memory we can increase the number of blocks. This allows us to reduce the average block size, which means faster scan inside a block.

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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `FSTDictionary.Browser` Stateful `FSTDictionary.Browser` to seek a term in this `FSTDictionary` and get its corresponding block file pointer in the block file.
    `static class` | `FSTDictionary.BrowserSupplier` Provides stateful `FSTDictionary.Browser` to seek in the `FSTDictionary`.
    `static class` | `FSTDictionary.Builder` Builds an immutable `FSTDictionary`.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FST<Long>` | `fst`

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

      `NULL_ACCOUNTABLE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `FSTDictionary(FST<Long> fst)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FSTDictionary.Browser` | `browser()` Creates a new `IndexDictionary.Browser`.
    `long` | `ramBytesUsed()`
    `protected static FSTDictionary` | `read(DataInput input, BlockDecoder blockDecoder, boolean isFSTOnHeap)` Reads a `FSTDictionary` from the provided input.
    `void` | `write(DataOutput output, BlockEncoder blockEncoder)` Writes this dictionary to the provided output.

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

    - #### fst

          protected final FST<Long> fst

  - ### Constructor Detail

    - #### FSTDictionary

          protected FSTDictionary(FST<Long> fst)

  - ### Method Detail

    - #### ramBytesUsed

          public long ramBytesUsed()

      Specified by:
        `ramBytesUsed` in interface `Accountable`

    - #### write

          public void write(DataOutput output,
                            BlockEncoder blockEncoder)
                     throws IOException

      Description copied from interface: `IndexDictionary`
      Writes this dictionary to the provided output.
      Specified by:
        `write` in interface `IndexDictionary`
        `blockEncoder` - The `BlockEncoder` for specific encoding of this index dictionary; or null if none.
      Throws:
        `IOException`

    - #### read

          protected static FSTDictionary read(DataInput input,
                                              BlockDecoder blockDecoder,
                                              boolean isFSTOnHeap)
                                       throws IOException

      Reads a `FSTDictionary` from the provided input.
      Parameters:
        `blockDecoder` - The `BlockDecoder` to use for specific decoding; or null if none.
      Throws:
        `IOException`

    - #### browser

          public FSTDictionary.Browser browser()

      Description copied from interface: `IndexDictionary`
      Creates a new `IndexDictionary.Browser`.
      Specified by:
        `browser` in interface `IndexDictionary`

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