Class PhraseSuggestionBuilder

    • Field Detail


        protected static final ParseField MAXERRORS_FIELD

        protected static final ParseField RWE_LIKELIHOOD_FIELD

        protected static final ParseField SEPARATOR_FIELD

        protected static final ParseField CONFIDENCE_FIELD

        protected static final ParseField GRAMSIZE_FIELD

        protected static final ParseField SMOOTHING_MODEL_FIELD

        protected static final ParseField FORCE_UNIGRAM_FIELD

        protected static final ParseField TOKEN_LIMIT_FIELD

        protected static final ParseField HIGHLIGHT_FIELD

        protected static final ParseField PRE_TAG_FIELD

        protected static final ParseField POST_TAG_FIELD

        protected static final ParseField COLLATE_FIELD

        protected static final ParseField COLLATE_QUERY_FIELD

        protected static final ParseField COLLATE_QUERY_PARAMS

        protected static final ParseField COLLATE_QUERY_PRUNE
    • Constructor Detail

      • PhraseSuggestionBuilder

        public PhraseSuggestionBuilder​(java.lang.String field)
      • PhraseSuggestionBuilder

        public PhraseSuggestionBuilder​(StreamInput in)
        Read from a stream.
    • Method Detail

      • gramSize

        public PhraseSuggestionBuilder gramSize​(int gramSize)
        Sets the gram size for the n-gram model used for this suggester. The default value is 1 corresponding to unigrams. Use 2 for bigrams and 3 for trigrams.
      • gramSize

        public java.lang.Integer gramSize()
        get the gramSize(int) parameter
      • maxErrors

        public PhraseSuggestionBuilder maxErrors​(float maxErrors)
        Sets the maximum percentage of the terms that at most 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 a number >=1 as an absolute number of query terms. The default is set to 1.0 which corresponds to that only corrections with at most 1 misspelled term are returned.
      • maxErrors

        public java.lang.Float maxErrors()
        get the maxErrors setting
      • separator

        public PhraseSuggestionBuilder separator​(java.lang.String separator)
        Sets the separator that is used to separate terms in the bigram field. If not set the whitespace character is used as a separator.
      • separator

        public java.lang.String separator()
        get the separator that is used to separate terms in the bigram field.
      • realWordErrorLikelihood

        public PhraseSuggestionBuilder realWordErrorLikelihood​(float realWordErrorLikelihood)
        Sets the likelihood of a term being a misspelled even if the term exists in the dictionary. The default it 0.95 corresponding to 5% or the real words are misspelled.
      • confidence

        public PhraseSuggestionBuilder confidence​(float confidence)
        Sets the confidence level for this suggester. The confidence level 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. For instance a confidence level of 1.0 will only return suggestions that score higher than the input phrase. If set to 0.0 the top N candidates are returned. The default is 1.0
      • confidence

        public java.lang.Float confidence()
        get the confidence() parameter
      • clearCandidateGenerators

        public PhraseSuggestionBuilder clearCandidateGenerators()
        Clear the candidate generators.
      • forceUnigrams

        public PhraseSuggestionBuilder forceUnigrams​(boolean forceUnigrams)
        If set to true the phrase suggester will fail if the analyzer only produces ngrams. the default it true.
      • forceUnigrams

        public java.lang.Boolean forceUnigrams()
        get the setting for forceUnigrams()
      • tokenLimit

        public java.lang.Integer tokenLimit()
        get the tokenLimit(int) parameter
      • highlight

        public PhraseSuggestionBuilder highlight​(java.lang.String preTag,
                                                 java.lang.String postTag)
        Setup highlighting for suggestions. If this is called a highlight field is returned with suggestions wrapping changed tokens with preTag and postTag.
      • collateQuery

        public PhraseSuggestionBuilder collateQuery​(java.lang.String collateQuery)
        Sets a query used for filtering out suggested phrases (collation).
      • collateQuery

        public PhraseSuggestionBuilder collateQuery​(Script collateQueryTemplate)
        Sets a query used for filtering out suggested phrases (collation).
      • collateQuery

        public Script collateQuery()
        gets the query used for filtering out suggested phrases (collation).
      • collateParams

        public PhraseSuggestionBuilder collateParams​(java.util.Map<java.lang.String,​java.lang.Object> collateParams)
        Adds additional parameters for collate scripts. Previously added parameters on the same builder will be overwritten.
      • collateParams

        public java.util.Map<java.lang.String,​java.lang.Object> collateParams()
        gets additional params for collate script
      • collatePrune

        public PhraseSuggestionBuilder collatePrune​(boolean collatePrune)
        Sets whether to prune suggestions after collation
      • collatePrune

        public java.lang.Boolean collatePrune()
        Gets whether to prune suggestions after collation
      • getWriteableName

        public java.lang.String getWriteableName()
        Description copied from interface: NamedWriteable
        Returns the name of the writeable object