Class PhraseSuggester.Builder

All Implemented Interfaces:
WithJson<PhraseSuggester.Builder>, ObjectBuilder<PhraseSuggester>
Enclosing class:
PhraseSuggester

public static class PhraseSuggester.Builder extends SuggesterBase.AbstractBuilder<PhraseSuggester.Builder> implements ObjectBuilder<PhraseSuggester>
Builder for PhraseSuggester.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • collate

      public final PhraseSuggester.Builder collate(@Nullable PhraseSuggestCollate value)
      Checks each suggestion against the specified query to prune suggestions for which no matching docs exist in the index.

      API name: collate

    • collate

      Checks each suggestion against the specified query to prune suggestions for which no matching docs exist in the index.

      API name: collate

    • confidence

      public final PhraseSuggester.Builder confidence(@Nullable Double value)
      Defines a factor applied to the input phrases score, which is used as a threshold for other suggest candidates. Only candidates that score higher than the threshold will be included in the result.

      API name: confidence

    • directGenerator

      public final PhraseSuggester.Builder directGenerator(List<DirectGenerator> list)
      A list of candidate generators that produce a list of possible terms per term in the given text.

      API name: direct_generator

      Adds all elements of list to directGenerator.

    • directGenerator

      public final PhraseSuggester.Builder directGenerator(DirectGenerator value, DirectGenerator... values)
      A list of candidate generators that produce a list of possible terms per term in the given text.

      API name: direct_generator

      Adds one or more values to directGenerator.

    • directGenerator

      A list of candidate generators that produce a list of possible terms per term in the given text.

      API name: direct_generator

      Adds a value to directGenerator using a builder lambda.

    • forceUnigrams

      public final PhraseSuggester.Builder forceUnigrams(@Nullable Boolean value)
      API name: force_unigrams
    • gramSize

      public final PhraseSuggester.Builder gramSize(@Nullable Integer value)
      Sets max size of the n-grams (shingles) in the field. If the field doesn’t contain n-grams (shingles), this should be omitted or set to 1. If the field uses a shingle filter, the gram_size is set to the max_shingle_size if not explicitly set.

      API name: gram_size

    • highlight

      public final PhraseSuggester.Builder highlight(@Nullable PhraseSuggestHighlight value)
      Sets up suggestion highlighting. If not provided, no highlighted field is returned.

      API name: highlight

    • highlight

      Sets up suggestion highlighting. If not provided, no highlighted field is returned.

      API name: highlight

    • maxErrors

      public final PhraseSuggester.Builder maxErrors(@Nullable Double value)
      The maximum percentage of the terms considered to be misspellings in order to form a correction. This method accepts a float value in the range [0..1) as a fraction of the actual query terms or a number >=1 as an absolute number of query terms.

      API name: max_errors

    • realWordErrorLikelihood

      public final PhraseSuggester.Builder realWordErrorLikelihood(@Nullable Double value)
      The likelihood of a term being misspelled even if the term exists in the dictionary.

      API name: real_word_error_likelihood

    • separator

      public final PhraseSuggester.Builder separator(@Nullable String value)
      The separator that is used to separate terms in the bigram field. If not set, the whitespace character is used as a separator.

      API name: separator

    • shardSize

      public final PhraseSuggester.Builder shardSize(@Nullable Integer value)
      Sets the maximum number of suggested terms to be retrieved from each individual shard.

      API name: shard_size

    • smoothing

      public final PhraseSuggester.Builder smoothing(@Nullable SmoothingModel value)
      The smoothing model used to balance weight between infrequent grams (grams (shingles) are not existing in the index) and frequent grams (appear at least once in the index). The default model is Stupid Backoff.

      API name: smoothing

    • smoothing

      The smoothing model used to balance weight between infrequent grams (grams (shingles) are not existing in the index) and frequent grams (appear at least once in the index). The default model is Stupid Backoff.

      API name: smoothing

    • smoothing

      public final PhraseSuggester.Builder smoothing(SmoothingModelVariant value)
      The smoothing model used to balance weight between infrequent grams (grams (shingles) are not existing in the index) and frequent grams (appear at least once in the index). The default model is Stupid Backoff.

      API name: smoothing

    • tokenLimit

      public final PhraseSuggester.Builder tokenLimit(@Nullable Integer value)
      API name: token_limit
    • self

      protected PhraseSuggester.Builder self()
      Specified by:
      self in class SuggesterBase.AbstractBuilder<PhraseSuggester.Builder>
    • build

      public PhraseSuggester build()
      Builds a PhraseSuggester.
      Specified by:
      build in interface ObjectBuilder<PhraseSuggester>
      Throws:
      NullPointerException - if some of the required fields are null.