Class HighlightOperator

java.lang.Object
org.elasticsearch.compute.operator.AbstractPageMappingOperator
org.elasticsearch.compute.operator.HighlightOperator
All Implemented Interfaces:
Closeable, AutoCloseable, Operator, Releasable

public class HighlightOperator extends AbstractPageMappingOperator
Appends one highlighted keyword column per ON field to the input page.

Each ON field is evaluated to its BytesRefBlock value and highlighted per row using a Lucene MemoryIndex: the row's (possibly multi-valued) text is analyzed into a single in-memory document and the configured Query is run against it through a CustomUnifiedHighlighter. Matched terms are wrapped with the configured tags by the PassageFormatter. A row that the query does not match yields null (or, when no_match_size > 0, the leading text). Multiple fragments and multi-valued inputs become a multi-value keyword block.

The MemoryIndex is built with offsets, so we read them via UnifiedHighlighter.OffsetSource.POSTINGS. This is the same coordinator-side path that TOP_SNIPPETS already uses. Unlike Query DSL highlighting, this path truncates analyzed tokens at the configured/default offset instead of throwing the "field too long" error.

TODO: use real index offsets and per-field analyzers when highlighting can run directly against shard data.