jruby/docs BETA
Navigation
org.apache.lucene.util.fst 15
C ByteSequenceOutputs
C BytesRefFSTEnum
C CharSequenceOutputs
C FST
C FSTCompiler
I FSTReader
C IntSequenceOutputs
C IntsRefFSTEnum
C NoOutputs
C OffHeapFSTStore
C OnHeapFSTStore
C Outputs
C PairOutputs
C PositiveIntOutputs
C Util
FSTCompiler — members 9
C add(input, output)
M arc_count() long
M compile() FSTMetadata<T>
M direct_addressing_max_oversizing_factor() float
M fst_ram_bytes_used() long
M fst_reader() FSTReader
M fst_size_in_bytes() long
M get_on_heap_reader_writer(block_bits) DataOutput
M node_count() long

org.apache.lucene.util.fst.FSTCompiler

class 9 members

Builds a minimal FST (maps an IntsRef term to an arbitrary output) from pre-sorted terms with outputs. The FST becomes an FSA if you use NoOutputs. The FST is written on-the-fly into a compact serialized format byte array, which can be saved to / loaded from a Directory or used directly for traversal. The FST is always finite (no cycles).

NOTE: The algorithm is described at http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.24.3698

The parameterized type T is the output type. See the subclasses of Outputs.

FSTs larger than 2.1GB are now possible (as of Lucene 4.2). FSTs containing more than 2.1B nodes are also now possible, however they cannot be packed.

It now supports 3 different workflows:

- Build FST and use it immediately entirely in RAM and then discard it

- Build FST and use it immediately entirely in RAM and also save it to other DataOutput, and load it later and use it

- Build FST but stream it immediately to disk (except the FSTMetaData, to be saved at the end). In order to use it, you need to construct the corresponding DataInput and use the FST constructor to read it.

Class Methods

get_on_heap_reader_writer

DataOutput get_on_heap_reader_writer ( int block_bits )
Java: getOnHeapReaderWriter(int blockBits)

Get an on-heap DataOutput that allows the FST to be read immediately after writing, and also optionally saved to an external DataOutput.

nametypedescription
block_bitsinthow many bits wide to make each block of the DataOutput

Returns: the DataOutput

Instance Methods

add

add ( IntsRef input, T output )
Java: add(org.apache.lucene.util.IntsRef input, T output)

Add the next input/output pair. The provided input must be sorted after the previous one according to IntsRef#compareTo. It's also OK to add the same input twice in a row with different outputs, as long as Outputs implements the Outputs#merge method. Note that input is fully consumed after this method is returned (so caller is free to reuse), but output is not. So if your outputs are changeable (eg ByteSequenceOutputs or IntSequenceOutputs) then you cannot reuse across calls.

arc_count

long arc_count ( )
Java: getArcCount() · also: get_arc_count

compile

FST.FSTMetadata<T> compile ( )
Java: compile()

Returns the metadata of the final FST. NOTE: this will return null if nothing is accepted by the FST themselves.

To create the FST, you need to:

- If a FSTReader DataOutput was used, such as the one returned by #getOnHeapReaderWriter(int)

    fstMetadata = fstCompiler.compile();
    fst = FST.fromFSTReader(fstMetadata, fstCompiler.getFSTReader());

- If a non-FSTReader DataOutput was used, such as org.apache.lucene.store.IndexOutput, you need to first create the corresponding org.apache.lucene.store.DataInput, such as org.apache.lucene.store.IndexInput then pass it to the FST construct

    fstMetadata = fstCompiler.compile();
    fst = new FST<>(fstMetadata, dataInput, new OffHeapFSTStore());

direct_addressing_max_oversizing_factor

float direct_addressing_max_oversizing_factor ( )
Java: getDirectAddressingMaxOversizingFactor() · also: get_direct_addressing_max_oversizing_factor

fst_ram_bytes_used

long fst_ram_bytes_used ( )
Java: fstRamBytesUsed()

fst_reader

FSTReader fst_reader ( )
Java: getFSTReader() · also: get_fst_reader

Get the respective FSTReader of the DataOutput. To call this method, you need to use the default DataOutput or #getOnHeapReaderWriter(int), otherwise we will throw an exception.

Returns: the DataOutput as FSTReader

Throws

IllegalStateException if the DataOutput does not implement FSTReader

fst_size_in_bytes

long fst_size_in_bytes ( )
Java: fstSizeInBytes()

node_count

long node_count ( )
Java: getNodeCount() · also: get_node_count
this work for additional information regarding copyright ownership.