Module org.apache.lucene.suggest
Class NRTSuggesterBuilder
java.lang.Object
org.apache.lucene.search.suggest.document.NRTSuggesterBuilder
Builder for
NRTSuggester-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BytesRefBuilderstatic final intMarks end of the analyzed input and start of dedup byte.private final intprivate final PriorityQueue<NRTSuggesterBuilder.Entry> private final FSTCompiler<PairOutputs.Pair<Long, BytesRef>> private intprivate final PairOutputs<Long, BytesRef> static final intLabel used to separate surface form and docID in the outputprivate final intprivate final IntsRefBuilder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an entry for the latest input term, should be called afterstartTerm(org.apache.lucene.util.BytesRef)on the desired inputvoidWrites all the entries for the FST input termprivate static intmaxNumArcsForDedupByte(int currentNumDedupBytes) Num arcs for nth dedup byte: if n invalid input: '<'= 5: 1 + (2 * n) else: (1 + (2 * n)) * nvoidInitializes 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 Details
-
PAYLOAD_SEP
public static final int PAYLOAD_SEPLabel used to separate surface form and docID in the output- See Also:
-
END_BYTE
public static final int END_BYTEMarks end of the analyzed input and start of dedup byte.- See Also:
-
outputs
-
fstCompiler
-
scratchInts
-
analyzed
-
entries
-
payloadSep
private final int payloadSep -
endByte
private final int endByte -
maxAnalyzedPathsPerOutput
private int maxAnalyzedPathsPerOutput
-
-
Constructor Details
-
NRTSuggesterBuilder
Create a builder forNRTSuggester- Throws:
IOException
-
-
Method Details
-
startTerm
Initializes an FST input term to add entries against -
addEntry
Adds an entry for the latest input term, should be called afterstartTerm(org.apache.lucene.util.BytesRef)on the desired input- Throws:
IOException
-
finishTerm
Writes all the entries for the FST input term- Throws:
IOException
-
store
Builds and stores a FST that can be loaded withNRTSuggester.load(IndexInput, CompletionPostingsFormat.FSTLoadMode))}- Throws:
IOException
-
maxNumArcsForDedupByte
private static int maxNumArcsForDedupByte(int currentNumDedupBytes) Num arcs for nth dedup byte: if n invalid input: '<'= 5: 1 + (2 * n) else: (1 + (2 * n)) * nTODO: is there a better way to make the fst built to be more TopNSearcher friendly?
-