From fe6b9d62a5c5f9dbda772ff7a93b3c7584919c1b Mon Sep 17 00:00:00 2001 From: javanna Date: Wed, 7 Sep 2016 15:14:07 +0200 Subject: [PATCH] Remove parseElements method from SearchPhase interface Parse elements are always empty for all of our search phases. They can be non empty only for sub fetch phases as they are pluggable and search parse element is left to be used only for plugins that plug in their own sub fetch phase. Only FetchPhase needs now the parseElements method then. --- .../java/org/elasticsearch/search/SearchPhase.java | 12 ++++-------- .../java/org/elasticsearch/search/SearchService.java | 6 +----- .../org/elasticsearch/search/fetch/FetchPhase.java | 3 +-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/SearchPhase.java b/core/src/main/java/org/elasticsearch/search/SearchPhase.java index 48c041f12f5..33260706b3c 100644 --- a/core/src/main/java/org/elasticsearch/search/SearchPhase.java +++ b/core/src/main/java/org/elasticsearch/search/SearchPhase.java @@ -21,22 +21,18 @@ package org.elasticsearch.search; import org.elasticsearch.search.internal.SearchContext; -import java.util.Collections; -import java.util.Map; - /** - * + * Represents a phase of a search request e.g. query, fetch etc. */ public interface SearchPhase { - default Map parseElements() { - return Collections.emptyMap(); - } - /** * Performs pre processing of the search context before the execute. */ void preProcess(SearchContext context); + /** + * Executes the search phase + */ void execute(SearchContext context); } diff --git a/core/src/main/java/org/elasticsearch/search/SearchService.java b/core/src/main/java/org/elasticsearch/search/SearchService.java index ba39c55a7a2..daebe480e04 100644 --- a/core/src/main/java/org/elasticsearch/search/SearchService.java +++ b/core/src/main/java/org/elasticsearch/search/SearchService.java @@ -165,11 +165,7 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings); this.defaultKeepAlive = DEFAULT_KEEPALIVE_SETTING.get(settings).millis(); - Map elementParsers = new HashMap<>(); - elementParsers.putAll(dfsPhase.parseElements()); - elementParsers.putAll(queryPhase.parseElements()); - elementParsers.putAll(fetchPhase.parseElements()); - this.elementParsers = unmodifiableMap(elementParsers); + this.elementParsers = unmodifiableMap(fetchPhase.parseElements()); this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME); diff --git a/core/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java b/core/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java index 997cb7caa4b..e10d7828a8a 100644 --- a/core/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java +++ b/core/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java @@ -66,7 +66,7 @@ import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.common.xcontent.XContentFactory.contentBuilder; /** - * + * Fetch phase of a search request */ public class FetchPhase implements SearchPhase { @@ -77,7 +77,6 @@ public class FetchPhase implements SearchPhase { this.fetchSubPhases[fetchSubPhases.size()] = new InnerHitsFetchSubPhase(this); } - @Override public Map parseElements() { Map parseElements = new HashMap<>(); for (FetchSubPhase fetchSubPhase : fetchSubPhases) {