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 String[] preTags
      • postTags

        protected String[] postTags
      • fragmentSize

        protected Integer fragmentSize
      • numOfFragments

        protected Integer numOfFragments
      • highlighterType

        protected String highlighterType
      • fragmenter

        protected String fragmenter
      • highlightFilter

        protected Boolean highlightFilter
      • forceSource

        protected Boolean forceSource
      • boundaryMaxScan

        protected Integer boundaryMaxScan
      • boundaryChars

        protected char[] boundaryChars
      • boundaryScannerLocale

        protected Locale boundaryScannerLocale
      • noMatchSize

        protected Integer noMatchSize
      • phraseLimit

        protected Integer phraseLimit
      • requireFieldMatch

        protected Boolean requireFieldMatch
    • Method Detail

      • preTags

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

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

        public HB highlighterType​(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​(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"
      • highlightQuery

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

        public HB order​(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​(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​(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​(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​(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​(Map<String,​Object> options)
        Allows to set custom options for custom highlighters.
      • requireFieldMatch

        public HB requireFieldMatch​(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​(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
      • phraseLimit

        public HB phraseLimit​(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
      • forceSource

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

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

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

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

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