Class FSTDictionary
- java.lang.Object
-
- org.apache.lucene.codecs.uniformsplit.FSTDictionary
-
- All Implemented Interfaces:
IndexDictionary
,Accountable
public class FSTDictionary extends java.lang.Object implements IndexDictionary
Immutable statelessFST
-based index dictionary kept in memory.Use
IndexDictionary.Builder
to build theIndexDictionary
.Create a stateful
IndexDictionary.Browser
to seek a term in thisIndexDictionary
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, withPositiveIntOutputs
.
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
FSTDictionary.Browser
static class
FSTDictionary.Builder
Builds an immutableFSTDictionary
.
-
Field Summary
Fields Modifier and Type Field Description private static long
BASE_RAM_USAGE
protected FST<java.lang.Long>
dictionary
-
Constructor Summary
Constructors Modifier Constructor Description protected
FSTDictionary(FST<java.lang.Long> dictionary)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FSTDictionary.Browser
browser()
Creates a newIndexDictionary.Browser
.long
ramBytesUsed()
Return the memory usage of this object in bytes.protected static FSTDictionary
read(DataInput input, BlockDecoder blockDecoder)
Reads aFSTDictionary
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
-
BASE_RAM_USAGE
private static final long BASE_RAM_USAGE
-
dictionary
protected final FST<java.lang.Long> dictionary
-
-
Constructor Detail
-
FSTDictionary
protected FSTDictionary(FST<java.lang.Long> dictionary)
-
-
Method Detail
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-
write
public void write(DataOutput output, BlockEncoder blockEncoder) throws java.io.IOException
Description copied from interface:IndexDictionary
Writes this dictionary to the provided output.- Specified by:
write
in interfaceIndexDictionary
blockEncoder
- TheBlockEncoder
for specific encoding of this index dictionary; or null if none.- Throws:
java.io.IOException
-
read
protected static FSTDictionary read(DataInput input, BlockDecoder blockDecoder) throws java.io.IOException
Reads aFSTDictionary
from the provided input.- Parameters:
blockDecoder
- TheBlockDecoder
to use for specific decoding; or null if none.- Throws:
java.io.IOException
-
browser
public FSTDictionary.Browser browser()
Description copied from interface:IndexDictionary
Creates a newIndexDictionary.Browser
.- Specified by:
browser
in interfaceIndexDictionary
-
-