Class HighlightBase.AbstractBuilder<BuilderT extends HighlightBase.AbstractBuilder<BuilderT>>

java.lang.Object
co.elastic.clients.util.ObjectBuilderBase
co.elastic.clients.util.WithJsonObjectBuilderBase<BuilderT>
co.elastic.clients.elasticsearch.core.search.HighlightBase.AbstractBuilder<BuilderT>
All Implemented Interfaces:
WithJson<BuilderT>
Direct Known Subclasses:
Highlight.Builder, HighlightField.Builder
Enclosing class:
HighlightBase

public abstract static class HighlightBase.AbstractBuilder<BuilderT extends HighlightBase.AbstractBuilder<BuilderT>> extends WithJsonObjectBuilderBase<BuilderT>
  • Constructor Details

    • AbstractBuilder

      public AbstractBuilder()
  • Method Details

    • type

      public final BuilderT type(@Nullable String value)
      API name: type
    • type

      public final BuilderT type(@Nullable HighlighterType value)
      API name: type
    • boundaryChars

      public final BuilderT boundaryChars(@Nullable String value)
      A string that contains each boundary character.

      API name: boundary_chars

    • boundaryMaxScan

      public final BuilderT boundaryMaxScan(@Nullable Integer value)
      How far to scan for boundary characters.

      API name: boundary_max_scan

    • boundaryScanner

      public final BuilderT boundaryScanner(@Nullable BoundaryScanner value)
      Specifies how to break the highlighted fragments: chars, sentence, or word. Only valid for the unified and fvh highlighters. Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter.

      API name: boundary_scanner

    • boundaryScannerLocale

      public final BuilderT boundaryScannerLocale(@Nullable String value)
      Controls which locale is used to search for sentence and word boundaries. This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP".

      API name: boundary_scanner_locale

    • forceSource

      @Deprecated public final BuilderT forceSource(@Nullable Boolean value)
      Deprecated.
      8.8.0
      API name: force_source
    • fragmenter

      public final BuilderT fragmenter(@Nullable HighlighterFragmenter value)
      Specifies how text should be broken up in highlight snippets: simple or span. Only valid for the plain highlighter.

      API name: fragmenter

    • fragmentSize

      public final BuilderT fragmentSize(@Nullable Integer value)
      The size of the highlighted fragment in characters.

      API name: fragment_size

    • highlightFilter

      public final BuilderT highlightFilter(@Nullable Boolean value)
      API name: highlight_filter
    • highlightQuery

      public final BuilderT highlightQuery(@Nullable Query value)
      Highlight matches for a query other than the search query. This is especially useful if you use a rescore query because those are not taken into account by highlighting by default.

      API name: highlight_query

    • highlightQuery

      public final BuilderT highlightQuery(Function<Query.Builder,ObjectBuilder<Query>> fn)
      Highlight matches for a query other than the search query. This is especially useful if you use a rescore query because those are not taken into account by highlighting by default.

      API name: highlight_query

    • maxFragmentLength

      public final BuilderT maxFragmentLength(@Nullable Integer value)
      API name: max_fragment_length
    • maxAnalyzedOffset

      public final BuilderT maxAnalyzedOffset(@Nullable Integer value)
      If set to a non-negative value, highlighting stops at this defined maximum limit. The rest of the text is not processed, thus not highlighted and no error is returned The max_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting.

      API name: max_analyzed_offset

    • noMatchSize

      public final BuilderT noMatchSize(@Nullable Integer value)
      The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.

      API name: no_match_size

    • numberOfFragments

      public final BuilderT numberOfFragments(@Nullable Integer value)
      The maximum number of fragments to return. If the number of fragments is set to 0, no fragments are returned. Instead, the entire field contents are highlighted and returned. This can be handy when you need to highlight short texts such as a title or address, but fragmentation is not required. If number_of_fragments is 0, fragment_size is ignored.

      API name: number_of_fragments

    • options

      public final BuilderT options(Map<String,JsonData> map)
      API name: options

      Adds all entries of map to options.

    • options

      public final BuilderT options(String key, JsonData value)
      API name: options

      Adds an entry to options.

    • order

      public final BuilderT order(@Nullable HighlighterOrder value)
      Sorts highlighted fragments by score when set to score. By default, fragments will be output in the order they appear in the field (order: none). Setting this option to score will output the most relevant fragments first. Each highlighter applies its own logic to compute relevancy scores.

      API name: order

    • phraseLimit

      public final BuilderT phraseLimit(@Nullable Integer value)
      Controls the number of matching phrases in a document that are considered. Prevents the fvh highlighter from analyzing too many phrases and consuming too much memory. When using matched_fields, phrase_limit phrases per matched field are considered. Raising the limit increases query time and consumes more memory. Only supported by the fvh highlighter.

      API name: phrase_limit

    • postTags

      public final BuilderT postTags(List<String> list)
      Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

      API name: post_tags

      Adds all elements of list to postTags.

    • postTags

      public final BuilderT postTags(String value, String... values)
      Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

      API name: post_tags

      Adds one or more values to postTags.

    • preTags

      public final BuilderT preTags(List<String> list)
      Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

      API name: pre_tags

      Adds all elements of list to preTags.

    • preTags

      public final BuilderT preTags(String value, String... values)
      Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

      API name: pre_tags

      Adds one or more values to preTags.

    • requireFieldMatch

      public final BuilderT requireFieldMatch(@Nullable Boolean value)
      By default, only fields that contains a query match are highlighted. Set to false to highlight all fields.

      API name: require_field_match

    • tagsSchema

      public final BuilderT tagsSchema(@Nullable HighlighterTagsSchema value)
      Set to styled to use the built-in tag schema.

      API name: tags_schema

    • self

      protected abstract BuilderT self()
      Specified by:
      self in class WithJsonObjectBuilderBase<BuilderT extends HighlightBase.AbstractBuilder<BuilderT>>