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 BytesRefBuilder
static final int
Marks end of the analyzed input and start of dedup byte.private final int
private final PriorityQueue<NRTSuggesterBuilder.Entry>
private final FSTCompiler<PairOutputs.Pair<Long,
BytesRef>> private int
private final PairOutputs<Long,
BytesRef> static final int
Label used to separate surface form and docID in the outputprivate final int
private final IntsRefBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an entry for the latest input term, should be called afterstartTerm(org.apache.lucene.util.BytesRef)
on the desired inputvoid
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
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 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
public NRTSuggesterBuilder()Create a builder forNRTSuggester
-
-
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 <= 5: 1 + (2 * n) else: (1 + (2 * n)) * nTODO: is there a better way to make the fst built to be more TopNSearcher friendly?
-