final class NRTSuggesterBuilder
extends java.lang.Object
NRTSuggester
Modifier and Type | Class and Description |
---|---|
private static class |
NRTSuggesterBuilder.Entry |
Modifier and Type | Field and Description |
---|---|
private BytesRefBuilder |
analyzed |
private Builder<PairOutputs.Pair<java.lang.Long,BytesRef>> |
builder |
static int |
END_BYTE
Marks end of the analyzed input and start of dedup
byte.
|
private int |
endByte |
private java.util.PriorityQueue<NRTSuggesterBuilder.Entry> |
entries |
private int |
maxAnalyzedPathsPerOutput |
private PairOutputs<java.lang.Long,BytesRef> |
outputs |
static int |
PAYLOAD_SEP
Label used to separate surface form and docID
in the output
|
private int |
payloadSep |
private IntsRefBuilder |
scratchInts |
Constructor and Description |
---|
NRTSuggesterBuilder()
Create a builder for
NRTSuggester |
Modifier and Type | Method and Description |
---|---|
void |
addEntry(int docID,
BytesRef surfaceForm,
long weight)
Adds an entry for the latest input term, should be called after
startTerm(org.apache.lucene.util.BytesRef) on the desired input |
void |
finishTerm()
Writes all the entries for the FST input term
|
private static int |
maxNumArcsForDedupByte(int currentNumDedupBytes)
Num arcs for nth dedup byte:
if n <= 5: 1 + (2 * n)
else: (1 + (2 * n)) * n
|
void |
startTerm(BytesRef analyzed)
Initializes an FST input term to add entries against
|
boolean |
store(DataOutput output)
Builds and stores a FST that can be loaded with
NRTSuggester.load(org.apache.lucene.store.IndexInput) |
public static final int PAYLOAD_SEP
public static final int END_BYTE
private final PairOutputs<java.lang.Long,BytesRef> outputs
private final Builder<PairOutputs.Pair<java.lang.Long,BytesRef>> builder
private final IntsRefBuilder scratchInts
private final BytesRefBuilder analyzed
private final java.util.PriorityQueue<NRTSuggesterBuilder.Entry> entries
private final int payloadSep
private final int endByte
private int maxAnalyzedPathsPerOutput
public NRTSuggesterBuilder()
NRTSuggester
public void startTerm(BytesRef analyzed)
public void addEntry(int docID, BytesRef surfaceForm, long weight) throws java.io.IOException
startTerm(org.apache.lucene.util.BytesRef)
on the desired inputjava.io.IOException
public void finishTerm() throws java.io.IOException
java.io.IOException
public boolean store(DataOutput output) throws java.io.IOException
NRTSuggester.load(org.apache.lucene.store.IndexInput)
java.io.IOException
private static int maxNumArcsForDedupByte(int currentNumDedupBytes)
TODO: is there a better way to make the fst built to be more TopNSearcher friendly?