Class SuggestionBuilder<T extends SuggestionBuilder<T>>

    • Field Detail

      • field

        protected final java.lang.String field
      • text

        protected java.lang.String text
      • prefix

        protected java.lang.String prefix
      • regex

        protected java.lang.String regex
      • analyzer

        protected java.lang.String analyzer
      • size

        protected java.lang.Integer size
      • shardSize

        protected java.lang.Integer shardSize
      • TEXT_FIELD

        protected static final ParseField TEXT_FIELD
      • PREFIX_FIELD

        protected static final ParseField PREFIX_FIELD
      • REGEX_FIELD

        protected static final ParseField REGEX_FIELD
      • FIELDNAME_FIELD

        protected static final ParseField FIELDNAME_FIELD
      • ANALYZER_FIELD

        protected static final ParseField ANALYZER_FIELD
      • SIZE_FIELD

        protected static final ParseField SIZE_FIELD
      • SHARDSIZE_FIELD

        protected static final ParseField SHARDSIZE_FIELD
    • Constructor Detail

      • SuggestionBuilder

        protected SuggestionBuilder​(java.lang.String field)
        Creates a new suggestion.
        Parameters:
        field - field to execute suggestions on
      • SuggestionBuilder

        protected SuggestionBuilder​(java.lang.String field,
                                    SuggestionBuilder<?> in)
        internal copy constructor that copies over all class fields from second SuggestionBuilder except field name.
      • SuggestionBuilder

        protected SuggestionBuilder​(StreamInput in)
                             throws java.io.IOException
        Read from a stream.
        Throws:
        java.io.IOException
    • Method Detail

      • doWriteTo

        protected abstract void doWriteTo​(StreamOutput out)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • text

        public java.lang.String text()
        get the text for this suggestion
      • prefix

        protected T prefix​(java.lang.String prefix)
      • prefix

        public java.lang.String prefix()
        get the prefix for this suggestion
      • regex

        protected T regex​(java.lang.String regex)
      • regex

        public java.lang.String regex()
        get the regex for this suggestion
      • field

        public java.lang.String field()
        get the field() parameter
      • analyzer

        public T analyzer​(java.lang.String analyzer)
        Sets the analyzer to analyse to suggest text with. Defaults to the search analyzer of the suggest field.
      • analyzer

        public java.lang.String analyzer()
        get the analyzer() parameter
      • size

        public T size​(int size)
        Sets the maximum suggestions to be returned per suggest text term.
      • size

        public java.lang.Integer size()
        get the size() parameter
      • shardSize

        public T shardSize​(java.lang.Integer shardSize)
        Sets the maximum number of suggested term to be retrieved from each individual shard. During the reduce phase the only the top N suggestions are returned based on the size option. Defaults to the size option.

        Setting this to a value higher than the `size` can be useful in order to get a more accurate document frequency for suggested terms. Due to the fact that terms are partitioned amongst shards, the shard level document frequencies of suggestions may not be precise. Increasing this will make these document frequencies more precise.

      • shardSize

        public java.lang.Integer shardSize()
        get the shardSize() parameter
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • doEquals

        protected abstract boolean doEquals​(T other)
        Indicates whether some other SuggestionBuilder of the same type is "equal to" this one.
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • doHashCode

        protected abstract int doHashCode()
        HashCode for the subclass of SuggestionBuilder to implement.