Class NRTSuggester

  • All Implemented Interfaces:
    Accountable

    public final class NRTSuggester
    extends java.lang.Object
    implements Accountable
    NRTSuggester executes Top N search on a weighted FST specified by a CompletionScorer

    See lookup(CompletionScorer, Bits, TopSuggestDocsCollector) for more implementation details.

    FST Format:

    • Input: analyzed forms of input terms
    • Output: Pair<Long, BytesRef> containing weight, surface form and docID

    NOTE:

    • having too many deletions or using a very restrictive filter can make the search inadmissible due to over-pruning of potential paths. See CompletionScorer.accept(int, Bits)
    • when matched documents are arbitrarily filtered (CompletionScorer.filtered set to true, it is assumed that the filter will roughly filter out half the number of documents that match the provided automaton
    • lookup performance will degrade as more accepted completions lead to filtered out documents
    • Field Detail

      • fst

        private final FST<PairOutputs.Pair<java.lang.Long,​BytesRef>> fst
        FST: input is the analyzed form, with a null byte between terms and a NRTSuggesterBuilder.END_BYTE to denote the end of the input weight is a long surface is the original, unanalyzed form followed by the docID
      • maxAnalyzedPathsPerOutput

        private final int maxAnalyzedPathsPerOutput
        Highest number of analyzed paths we saw for any single input surface form. This can be > 1, when index analyzer creates graphs or if multiple surface form(s) yields the same analyzed form
      • payloadSep

        private final int payloadSep
        Separator used between surface form and its docID in the FST output
      • MAX_TOP_N_QUEUE_SIZE

        private static final long MAX_TOP_N_QUEUE_SIZE
        Maximum queue depth for TopNSearcher

        NOTE: value should be <= Integer.MAX_VALUE

        See Also:
        Constant Field Values
    • Constructor Detail

      • NRTSuggester

        private NRTSuggester​(FST<PairOutputs.Pair<java.lang.Long,​BytesRef>> fst,
                             int maxAnalyzedPathsPerOutput,
                             int payloadSep)