Class AbstractHighlighterBuilder<HB extends AbstractHighlighterBuilder<?>>

    • Field Detail

      • PRE_TAGS_FIELD

        public static final ParseField PRE_TAGS_FIELD
      • POST_TAGS_FIELD

        public static final ParseField POST_TAGS_FIELD
      • FIELDS_FIELD

        public static final ParseField FIELDS_FIELD
      • ORDER_FIELD

        public static final ParseField ORDER_FIELD
      • HIGHLIGHT_FILTER_FIELD

        public static final ParseField HIGHLIGHT_FILTER_FIELD
      • FRAGMENT_SIZE_FIELD

        public static final ParseField FRAGMENT_SIZE_FIELD
      • FRAGMENT_OFFSET_FIELD

        public static final ParseField FRAGMENT_OFFSET_FIELD
      • NUMBER_OF_FRAGMENTS_FIELD

        public static final ParseField NUMBER_OF_FRAGMENTS_FIELD
      • ENCODER_FIELD

        public static final ParseField ENCODER_FIELD
      • REQUIRE_FIELD_MATCH_FIELD

        public static final ParseField REQUIRE_FIELD_MATCH_FIELD
      • BOUNDARY_SCANNER_FIELD

        public static final ParseField BOUNDARY_SCANNER_FIELD
      • BOUNDARY_MAX_SCAN_FIELD

        public static final ParseField BOUNDARY_MAX_SCAN_FIELD
      • BOUNDARY_CHARS_FIELD

        public static final ParseField BOUNDARY_CHARS_FIELD
      • BOUNDARY_SCANNER_LOCALE_FIELD

        public static final ParseField BOUNDARY_SCANNER_LOCALE_FIELD
      • TYPE_FIELD

        public static final ParseField TYPE_FIELD
      • FRAGMENTER_FIELD

        public static final ParseField FRAGMENTER_FIELD
      • NO_MATCH_SIZE_FIELD

        public static final ParseField NO_MATCH_SIZE_FIELD
      • FORCE_SOURCE_FIELD

        public static final ParseField FORCE_SOURCE_FIELD
      • PHRASE_LIMIT_FIELD

        public static final ParseField PHRASE_LIMIT_FIELD
      • OPTIONS_FIELD

        public static final ParseField OPTIONS_FIELD
      • HIGHLIGHT_QUERY_FIELD

        public static final ParseField HIGHLIGHT_QUERY_FIELD
      • MATCHED_FIELDS_FIELD

        public static final ParseField MATCHED_FIELDS_FIELD
      • preTags

        protected java.lang.String[] preTags
      • postTags

        protected java.lang.String[] postTags
      • fragmentSize

        protected java.lang.Integer fragmentSize
      • numOfFragments

        protected java.lang.Integer numOfFragments
      • highlighterType

        protected java.lang.String highlighterType
      • fragmenter

        protected java.lang.String fragmenter
      • highlightFilter

        protected java.lang.Boolean highlightFilter
      • forceSource

        protected java.lang.Boolean forceSource
      • boundaryMaxScan

        protected java.lang.Integer boundaryMaxScan
      • boundaryChars

        protected char[] boundaryChars
      • boundaryScannerLocale

        protected java.util.Locale boundaryScannerLocale
      • noMatchSize

        protected java.lang.Integer noMatchSize
      • phraseLimit

        protected java.lang.Integer phraseLimit
      • options

        protected java.util.Map<java.lang.String,​java.lang.Object> options
      • requireFieldMatch

        protected java.lang.Boolean requireFieldMatch
    • Constructor Detail

      • AbstractHighlighterBuilder

        public AbstractHighlighterBuilder()
      • AbstractHighlighterBuilder

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

      • writeTo

        public final void writeTo​(StreamOutput out)
                           throws java.io.IOException
        write common parameters to StreamOutput
        Specified by:
        writeTo in interface Writeable
        Throws:
        java.io.IOException
      • doWriteTo

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

        public HB preTags​(java.lang.String... preTags)
        Set the pre tags that will be used for highlighting.
      • preTags

        public java.lang.String[] preTags()
        Returns:
        the value set by preTags(String...)
      • postTags

        public HB postTags​(java.lang.String... postTags)
        Set the post tags that will be used for highlighting.
      • postTags

        public java.lang.String[] postTags()
        Returns:
        the value set by postTags(String...)
      • highlighterType

        public HB highlighterType​(java.lang.String highlighterType)
        Set type of highlighter to use. Out of the box supported types are unified, plain and fvj. Defaults to unified. Details of the different highlighter types are covered in the reference guide.
      • fragmenter

        public HB fragmenter​(java.lang.String fragmenter)
        Sets what fragmenter to use to break up text that is eligible for highlighting. This option is only applicable when using the plain highlighterType highlighter. Permitted values are "simple" or "span" relating to SimpleFragmenter and SimpleSpanFragmenter implementations respectively with the default being "span"
      • fragmenter

        public java.lang.String fragmenter()
        Returns:
        the value set by fragmenter(String)
      • highlightQuery

        public HB highlightQuery​(QueryBuilder highlightQuery)
        Sets a query to be used for highlighting instead of the search query.
      • order

        public HB order​(java.lang.String order)
        The order of fragments per field. By default, ordered by the order in the highlighted text. Can be score, which then it will be ordered by score of the fragments, or none.
      • highlightFilter

        public HB highlightFilter​(java.lang.Boolean highlightFilter)
        Set this to true when using the highlighterType fvh and you want to provide highlighting on filter clauses in your query. Default is false.
      • boundaryScannerType

        public HB boundaryScannerType​(java.lang.String boundaryScannerType)
        When using the highlighterType fvh this setting controls which scanner to use for fragment boundaries, and defaults to "simple".
      • boundaryScannerType

        public HB boundaryScannerType​(HighlightBuilder.BoundaryScannerType boundaryScannerType)
        When using the highlighterType fvh this setting controls which scanner to use for fragment boundaries, and defaults to "simple".
      • boundaryMaxScan

        public HB boundaryMaxScan​(java.lang.Integer boundaryMaxScan)
        When using the highlighterType fvh this setting controls how far to look for boundary characters, and defaults to 20.
      • boundaryChars

        public HB boundaryChars​(char[] boundaryChars)
        When using the highlighterType fvh this setting defines what constitutes a boundary for highlighting. It’s a single string with each boundary character defined in it. It defaults to .,!? \t\n
      • boundaryScannerLocale

        public HB boundaryScannerLocale​(java.lang.String boundaryScannerLocale)
        When using the highlighterType fvh and boundaryScannerType break_iterator, this setting controls the locale to use by the BreakIterator, defaults to "root".
      • options

        public HB options​(java.util.Map<java.lang.String,​java.lang.Object> options)
        Allows to set custom options for custom highlighters.
      • options

        public java.util.Map<java.lang.String,​java.lang.Object> options()
        Returns:
        the value set by options(Map)
      • requireFieldMatch

        public HB requireFieldMatch​(java.lang.Boolean requireFieldMatch)
        Set to true to cause a field to be highlighted only if a query matches that field. Default is false meaning that terms are highlighted on all requested fields regardless if the query matches specifically on them.
      • noMatchSize

        public HB noMatchSize​(java.lang.Integer noMatchSize)
        Sets the size of the fragment to return from the beginning of the field if there are no matches to highlight and the field doesn't also define noMatchSize.
        Parameters:
        noMatchSize - integer to set or null to leave out of request. default is null.
        Returns:
        this for chaining
      • noMatchSize

        public java.lang.Integer noMatchSize()
        Returns:
        the value set by noMatchSize(Integer)
      • phraseLimit

        public HB phraseLimit​(java.lang.Integer phraseLimit)
        Sets the maximum number of phrases the fvh will consider if the field doesn't also define phraseLimit.
        Parameters:
        phraseLimit - maximum number of phrases the fvh will consider
        Returns:
        this for chaining
      • phraseLimit

        public java.lang.Integer phraseLimit()
        Returns:
        the value set by phraseLimit(Integer)
      • forceSource

        public HB forceSource​(java.lang.Boolean forceSource)
        Forces the highlighting to highlight fields based on the source even if fields are stored separately.
      • forceSource

        public java.lang.Boolean forceSource()
        Returns:
        the value set by forceSource(Boolean)
      • innerXContent

        protected abstract void innerXContent​(XContentBuilder builder)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • hashCode

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

        protected abstract int doHashCode()
        fields only present in subclass should contribute to hashCode in the implementation
      • equals

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

        protected abstract boolean doEquals​(HB other)
        fields only present in subclass should be checked for equality in the implementation
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object