diff --git a/docs/reference/search/request/highlighting.asciidoc b/docs/reference/search/request/highlighting.asciidoc index 381bf472dd2..066df3e6fa0 100644 --- a/docs/reference/search/request/highlighting.asciidoc +++ b/docs/reference/search/request/highlighting.asciidoc @@ -909,7 +909,7 @@ Response: }, "highlight": { "message": [ - "some message with the number 1" + " with the number 1" ] } } diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorHighlightSubFetchPhase.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorHighlightSubFetchPhase.java index a0f3c006290..44823f9aa01 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorHighlightSubFetchPhase.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorHighlightSubFetchPhase.java @@ -53,13 +53,13 @@ import java.util.Map; * Highlighting in the case of the percolate query is a bit different, because the PercolateQuery itself doesn't get highlighted, * but the source of the PercolateQuery gets highlighted by each hit containing a query. */ -final class PercolatorHighlightSubFetchPhase extends HighlightPhase { +final class PercolatorHighlightSubFetchPhase implements FetchSubPhase { + private final HighlightPhase highlightPhase; PercolatorHighlightSubFetchPhase(Settings settings, Map highlighters) { - super(settings, highlighters); + this.highlightPhase = new HighlightPhase(settings, highlighters); } - boolean hitsExecutionNeeded(SearchContext context) { // for testing return context.highlight() != null && locatePercolatorQuery(context.query()).isEmpty() == false; } @@ -109,7 +109,7 @@ final class PercolatorHighlightSubFetchPhase extends HighlightPhase { percolatorLeafReaderContext, slot, percolatorIndexSearcher ); hitContext.cache().clear(); - super.hitExecute(subSearchContext, hitContext); + highlightPhase.hitExecute(subSearchContext, hitContext); for (Map.Entry entry : hitContext.hit().getHighlightFields().entrySet()) { if (percolateQuery.getDocuments().size() == 1) { String hlFieldName;