- All Implemented Interfaces:
Closeable,AutoCloseable,Operator,Releasable
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.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.elasticsearch.compute.operator.AbstractPageMappingOperator
AbstractPageMappingOperator.StatusNested classes/interfaces inherited from interface org.elasticsearch.compute.operator.Operator
Operator.OperatorFactory -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSynthetic field name under which each row's text is indexed in the per-rowMemoryIndex.Fields inherited from interface org.elasticsearch.compute.operator.Operator
MIN_TARGET_PAGE_SIZE, NOT_BLOCKED, TARGET_PAGE_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionHighlightOperator(BlockFactory blockFactory, HighlightConfig config, ExpressionEvaluator[] fieldEvaluators) -
Method Summary
Methods inherited from class org.elasticsearch.compute.operator.AbstractPageMappingOperator
addInput, canProduceMoreDataWithoutExtraInput, finish, getOutput, isFinished, needsInput, status, statusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.compute.operator.Operator
isBlocked, tryPromote
-
Field Details
-
CONTENT_FIELD
Synthetic field name under which each row's text is indexed in the per-rowMemoryIndex. The configuredQuerypassed to the factory must be built against this same field name.- See Also:
-
-
Constructor Details
-
HighlightOperator
public HighlightOperator(BlockFactory blockFactory, HighlightConfig config, ExpressionEvaluator[] fieldEvaluators)
-
-
Method Details
-
process
- Specified by:
processin classAbstractPageMappingOperator
-
toString
- Specified by:
toStringin classAbstractPageMappingOperator
-
close
public void close()Description copied from interface:Operatornotifies the operator that it won't be used anymore (i.e. none of the other methods called), and its resources can be cleaned up- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceOperator- Specified by:
closein interfaceReleasable- Overrides:
closein classAbstractPageMappingOperator
-