Record Class HighlightOptions
java.lang.Object
java.lang.Record
org.elasticsearch.xpack.esql.plan.logical.HighlightOptions
public record HighlightOptions(String preTag, String postTag, String encoder, int numberOfFragments, int fragmentSize, int noMatchSize, String boundaryScanner, Locale boundaryScannerLocale, String order, int maxAnalyzedOffset)
extends Record
Resolved, plain-Java view of the
WITH { ... } options of a Highlight command, with defaults applied.
Built once at local-execution-planning time from the (foldable) MapExpression so the operator factory only
deals with primitives.
boundary_chars, boundary_max_scan and phrase_limit are accepted for Query DSL parity but are
only honoured by the FastVectorHighlighter. HIGHLIGHT always uses the unified highlighter, so they are grammar-only
no-ops that never reach this record.
The validation done while building this record is also the single source of truth for analysis-time checks:
Highlight.postAnalysisVerification(org.elasticsearch.xpack.esql.common.Failures) reuses validate(java.lang.String, org.elasticsearch.xpack.esql.core.expression.Expression, org.elasticsearch.xpack.esql.core.expression.FoldContext) so invalid values fail during analysis rather
than only later during local planning.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA string-valued enum option together with its allowed values and case-sensitivity. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HighlightOptions.EnumOptionstatic final Stringstatic final Stringstatic final Stringstatic final Localestatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final HighlightOptions.EnumOptionstatic final Stringstatic final Stringstatic final HighlightOptions.EnumOptionstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theboundaryScannerrecord component.Returns the value of theboundaryScannerLocalerecord component.encoder()Returns the value of theencoderrecord component.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of thefragmentSizerecord component.static HighlightOptionsfrom(MapExpression options, FoldContext foldContext) final inthashCode()Returns a hash code value for this object.intReturns the value of themaxAnalyzedOffsetrecord component.intReturns the value of thenoMatchSizerecord component.intReturns the value of thenumberOfFragmentsrecord component.order()Returns the value of theorderrecord component.postTag()Returns the value of thepostTagrecord component.preTag()Returns the value of thepreTagrecord component.final StringtoString()Returns a string representation of this record class.static voidvalidate(String name, Expression value, FoldContext foldContext) Type/range-checks a single (non-null, foldable) option value by parsing it exactly asfrom(org.elasticsearch.xpack.esql.core.expression.MapExpression, org.elasticsearch.xpack.esql.core.expression.FoldContext)would and discarding the result, throwingIllegalArgumentExceptionon a bad value.
-
Field Details
-
DEFAULT_PRE_TAG
- See Also:
-
DEFAULT_POST_TAG
- See Also:
-
DEFAULT_ENCODER
- See Also:
-
HTML_ENCODER
- See Also:
-
DEFAULT_NUMBER_OF_FRAGMENTS
public static final int DEFAULT_NUMBER_OF_FRAGMENTS- See Also:
-
DEFAULT_FRAGMENT_SIZE
public static final int DEFAULT_FRAGMENT_SIZE- See Also:
-
DEFAULT_NO_MATCH_SIZE
public static final int DEFAULT_NO_MATCH_SIZE- See Also:
-
BOUNDARY_SCANNER_SENTENCE
- See Also:
-
BOUNDARY_SCANNER_WORD
- See Also:
-
ORDER_NONE
- See Also:
-
ORDER_SCORE
- See Also:
-
DEFAULT_BOUNDARY_SCANNER
- See Also:
-
DEFAULT_BOUNDARY_SCANNER_LOCALE
-
DEFAULT_ORDER
- See Also:
-
ALLOWED_ENCODERS
-
ALLOWED_BOUNDARY_SCANNERS
-
ALLOWED_ORDERS
-
DEFAULT_MAX_ANALYZED_OFFSET
public static final int DEFAULT_MAX_ANALYZED_OFFSET- See Also:
-
ENCODER_OPTION
-
BOUNDARY_SCANNER_OPTION
-
ORDER_OPTION
-
-
Constructor Details
-
HighlightOptions
public HighlightOptions(String preTag, String postTag, String encoder, int numberOfFragments, int fragmentSize, int noMatchSize, String boundaryScanner, Locale boundaryScannerLocale, String order, int maxAnalyzedOffset) Creates an instance of aHighlightOptionsrecord class.- Parameters:
preTag- the value for thepreTagrecord componentpostTag- the value for thepostTagrecord componentencoder- the value for theencoderrecord componentnumberOfFragments- the value for thenumberOfFragmentsrecord componentfragmentSize- the value for thefragmentSizerecord componentnoMatchSize- the value for thenoMatchSizerecord componentboundaryScanner- the value for theboundaryScannerrecord componentboundaryScannerLocale- the value for theboundaryScannerLocalerecord componentorder- the value for theorderrecord componentmaxAnalyzedOffset- the value for themaxAnalyzedOffsetrecord component
-
-
Method Details
-
from
-
validate
Type/range-checks a single (non-null, foldable) option value by parsing it exactly asfrom(org.elasticsearch.xpack.esql.core.expression.MapExpression, org.elasticsearch.xpack.esql.core.expression.FoldContext)would and discarding the result, throwingIllegalArgumentExceptionon a bad value. Enum options (encoder,boundary_scanner,order) are checked separately against theirHighlightOptions.EnumOptiondescriptor, andphrase_limitis grammar-only, so all of them are no-ops here.boundary_charsandboundary_max_scanare FastVectorHighlighter-only at execution but we still type-check them for Query DSL parity. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
preTag
Returns the value of thepreTagrecord component.- Returns:
- the value of the
preTagrecord component
-
postTag
Returns the value of thepostTagrecord component.- Returns:
- the value of the
postTagrecord component
-
encoder
Returns the value of theencoderrecord component.- Returns:
- the value of the
encoderrecord component
-
numberOfFragments
public int numberOfFragments()Returns the value of thenumberOfFragmentsrecord component.- Returns:
- the value of the
numberOfFragmentsrecord component
-
fragmentSize
public int fragmentSize()Returns the value of thefragmentSizerecord component.- Returns:
- the value of the
fragmentSizerecord component
-
noMatchSize
public int noMatchSize()Returns the value of thenoMatchSizerecord component.- Returns:
- the value of the
noMatchSizerecord component
-
boundaryScanner
Returns the value of theboundaryScannerrecord component.- Returns:
- the value of the
boundaryScannerrecord component
-
boundaryScannerLocale
Returns the value of theboundaryScannerLocalerecord component.- Returns:
- the value of the
boundaryScannerLocalerecord component
-
order
Returns the value of theorderrecord component.- Returns:
- the value of the
orderrecord component
-
maxAnalyzedOffset
public int maxAnalyzedOffset()Returns the value of themaxAnalyzedOffsetrecord component.- Returns:
- the value of the
maxAnalyzedOffsetrecord component
-