Package org.apache.lucene.codecs.uniformsplit

# Class FSTDictionary

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

All Implemented Interfaces:
  `IndexDictionary`

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
  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
  Description
  `protected final FST<Long>`
  `fst`

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FSTDictionary.Browser`
  `browser()`
  Creates a new `IndexDictionary.Browser`.
  `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`

- ## Field Details

  - ### fst

    protected final FST<Long> fst

- ## Constructor Details

  - ### FSTDictionary

    protected FSTDictionary(FST<Long> fst)

- ## Method Details

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