Class NRTSuggesterBuilder
- java.lang.Object
-
- org.apache.lucene.search.suggest.document.NRTSuggesterBuilder
-
final class NRTSuggesterBuilder extends java.lang.ObjectBuilder forNRTSuggester
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classNRTSuggesterBuilder.Entry
-
Field Summary
Fields Modifier and Type Field Description private BytesRefBuilderanalyzedprivate Builder<PairOutputs.Pair<java.lang.Long,BytesRef>>builderstatic intEND_BYTEMarks end of the analyzed input and start of dedup byte.private intendByteprivate java.util.PriorityQueue<NRTSuggesterBuilder.Entry>entriesprivate intmaxAnalyzedPathsPerOutputprivate PairOutputs<java.lang.Long,BytesRef>outputsstatic intPAYLOAD_SEPLabel used to separate surface form and docID in the outputprivate intpayloadSepprivate IntsRefBuilderscratchInts
-
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 voidaddEntry(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 inputvoidfinishTerm()Writes all the entries for the FST input termprivate static intmaxNumArcsForDedupByte(int currentNumDedupBytes)Num arcs for nth dedup byte: if n <= 5: 1 + (2 * n) else: (1 + (2 * n)) * nvoidstartTerm(BytesRef analyzed)Initializes an FST input term to add entries againstbooleanstore(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.IOExceptionAdds 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.IOExceptionWrites 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?
-
-