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.
This commit is contained in:
parent
55a2f26b21
commit
fe6b9d62a5
|
@ -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<String, ? extends SearchParseElement> 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);
|
||||
}
|
||||
|
|
|
@ -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<String, SearchParseElement> 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);
|
||||
|
||||
|
|
|
@ -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<String, ? extends SearchParseElement> parseElements() {
|
||||
Map<String, SearchParseElement> parseElements = new HashMap<>();
|
||||
for (FetchSubPhase fetchSubPhase : fetchSubPhases) {
|
||||
|
|
Loading…
Reference in New Issue