Class NRTSuggesterBuilder
- java.lang.Object
-
- org.apache.lucene.search.suggest.document.NRTSuggesterBuilder
-
final class NRTSuggesterBuilder extends java.lang.Object
Builder forNRTSuggester
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NRTSuggesterBuilder.Entry
-
Field Summary
Fields Modifier and Type Field 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 outputprivate int
payloadSep
private IntsRefBuilder
scratchInts
-
Constructor Summary
Constructors Constructor Description NRTSuggesterBuilder()
Create a builder forNRTSuggester
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntry(int docID, BytesRef surfaceForm, long weight)
Adds an entry for the latest input term, should be called afterstartTerm(org.apache.lucene.util.BytesRef)
on the desired inputvoid
finishTerm()
Writes all the entries for the FST input termprivate static int
maxNumArcsForDedupByte(int currentNumDedupBytes)
Num arcs for nth dedup byte: if n <= 5: 1 + (2 * n) else: (1 + (2 * n)) * nvoid
startTerm(BytesRef analyzed)
Initializes an FST input term to add entries againstboolean
store(DataOutput output)
Builds and stores a FST that can be loaded withNRTSuggester.load(IndexInput, CompletionPostingsFormat.FSTLoadMode)
)}
-
-
-
Field Detail
-
PAYLOAD_SEP
public static final int PAYLOAD_SEP
Label used to separate surface form and docID in the output- See Also:
- Constant Field Values
-
END_BYTE
public static final int END_BYTE
Marks end of the analyzed input and start of dedup byte.- See Also:
- Constant Field Values
-
outputs
private final PairOutputs<java.lang.Long,BytesRef> outputs
-
builder
private final Builder<PairOutputs.Pair<java.lang.Long,BytesRef>> builder
-
scratchInts
private final IntsRefBuilder scratchInts
-
analyzed
private final BytesRefBuilder analyzed
-
entries
private final java.util.PriorityQueue<NRTSuggesterBuilder.Entry> entries
-
payloadSep
private final int payloadSep
-
endByte
private final int endByte
-
maxAnalyzedPathsPerOutput
private int maxAnalyzedPathsPerOutput
-
-
Constructor Detail
-
NRTSuggesterBuilder
public NRTSuggesterBuilder()
Create a builder forNRTSuggester
-
-
Method Detail
-
startTerm
public void startTerm(BytesRef analyzed)
Initializes an FST input term to add entries against
-
addEntry
public void addEntry(int docID, BytesRef surfaceForm, long weight) throws java.io.IOException
Adds an entry for the latest input term, should be called afterstartTerm(org.apache.lucene.util.BytesRef)
on the desired input- Throws:
java.io.IOException
-
finishTerm
public void finishTerm() throws java.io.IOException
Writes all the entries for the FST input term- Throws:
java.io.IOException
-
store
public boolean store(DataOutput output) throws java.io.IOException
Builds and stores a FST that can be loaded withNRTSuggester.load(IndexInput, CompletionPostingsFormat.FSTLoadMode)
)}- Throws:
java.io.IOException
-
maxNumArcsForDedupByte
private static int maxNumArcsForDedupByte(int currentNumDedupBytes)
Num arcs for nth dedup byte: if n <= 5: 1 + (2 * n) else: (1 + (2 * n)) * nTODO: is there a better way to make the fst built to be more TopNSearcher friendly?
-
-