Package org.apache.lucene.codecs.uniformsplit

# Class FSTDictionary.Builder

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

All Implemented Interfaces:
  `IndexDictionary.Builder`

Enclosing class:
  `FSTDictionary`

public static class FSTDictionary.Builder extends Object implements IndexDictionary.Builder
Builds an immutable `FSTDictionary`.

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

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final FSTCompiler<Long>`
`fstCompiler`
`protected final IntsRefBuilder`
`scratchInts`

## Constructor Summary

Constructors
Constructor
Description
`Builder()`

## Method Summary

Modifier and Type
Method
Description
`void`
`add(BytesRef blockKey, long blockFilePointer)`
Adds a [block key - block file pointer] entry to the dictionary.
`FSTDictionary`
`build()`
Builds the immutable `IndexDictionary` for the added entries.

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

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

## Field Details

### fstCompiler

protected final FSTCompiler<Long> fstCompiler

### scratchInts

protected final IntsRefBuilder scratchInts

## Constructor Details

### Builder

public Builder() throws IOException

Throws:
  `IOException`

## Method Details

### add

public void add(BytesRef blockKey, long blockFilePointer) throws IOException
Description copied from interface: `IndexDictionary.Builder`
Adds a [block key - block file pointer] entry to the dictionary.

The Uniform Split technique adds block keys in the dictionary. See `BlockReader` and `TermBytes` for more info about block key and minimal distinguishing prefix (MDP).

All block keys are added in strictly increasing order of the block file pointers, this allows long encoding optimizations such as with `PositiveIntOutputs` for `FST`.

Specified by:
  `add` in interface `IndexDictionary.Builder`
Parameters:
  `blockKey` - The block key which is the minimal distinguishing prefix (MDP) of the first term of a block.
  `blockFilePointer` - Non-negative file pointer to the start of the block in the block file.
Throws:
  `IOException`

### build

public FSTDictionary build() throws IOException
Description copied from interface: `IndexDictionary.Builder`
Builds the immutable `IndexDictionary` for the added entries.

Specified by:
  `build` in interface `IndexDictionary.Builder`
Throws:
  `IOException`