Remove unused ClusterService dependency from SearchPhaseController (#21421)
This commit is contained in:
parent
06aabd9ecd
commit
10a4288a4c
|
@ -30,10 +30,8 @@ import org.apache.lucene.search.SortField;
|
|||
import org.apache.lucene.search.TermStatistics;
|
||||
import org.apache.lucene.search.TopDocs;
|
||||
import org.apache.lucene.search.TopFieldDocs;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.collect.HppcMaps;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.BigArrays;
|
||||
|
@ -72,7 +70,7 @@ import java.util.stream.StreamSupport;
|
|||
|
||||
public class SearchPhaseController extends AbstractComponent {
|
||||
|
||||
public static final Comparator<AtomicArray.Entry<? extends QuerySearchResultProvider>> QUERY_RESULT_ORDERING = (o1, o2) -> {
|
||||
private static final Comparator<AtomicArray.Entry<? extends QuerySearchResultProvider>> QUERY_RESULT_ORDERING = (o1, o2) -> {
|
||||
int i = o1.value.shardTarget().index().compareTo(o2.value.shardTarget().index());
|
||||
if (i == 0) {
|
||||
i = o1.value.shardTarget().shardId().id() - o2.value.shardTarget().shardId().id();
|
||||
|
@ -80,17 +78,15 @@ public class SearchPhaseController extends AbstractComponent {
|
|||
return i;
|
||||
};
|
||||
|
||||
public static final ScoreDoc[] EMPTY_DOCS = new ScoreDoc[0];
|
||||
private static final ScoreDoc[] EMPTY_DOCS = new ScoreDoc[0];
|
||||
|
||||
private final BigArrays bigArrays;
|
||||
private final ScriptService scriptService;
|
||||
private final ClusterService clusterService;
|
||||
|
||||
SearchPhaseController(Settings settings, BigArrays bigArrays, ScriptService scriptService, ClusterService clusterService) {
|
||||
SearchPhaseController(Settings settings, BigArrays bigArrays, ScriptService scriptService) {
|
||||
super(settings);
|
||||
this.bigArrays = bigArrays;
|
||||
this.scriptService = scriptService;
|
||||
this.clusterService = clusterService;
|
||||
}
|
||||
|
||||
public AggregatedDfs aggregateDfs(AtomicArray<DfsSearchResult> results) {
|
||||
|
@ -486,7 +482,7 @@ public class SearchPhaseController extends AbstractComponent {
|
|||
for (AtomicArray.Entry<? extends QuerySearchResultProvider> entry : queryResults) {
|
||||
aggregationsList.add((InternalAggregations) entry.value.queryResult().aggregations());
|
||||
}
|
||||
ReduceContext reduceContext = new ReduceContext(bigArrays, scriptService, clusterService.state());
|
||||
ReduceContext reduceContext = new ReduceContext(bigArrays, scriptService);
|
||||
aggregations = InternalAggregations.reduce(aggregationsList, reduceContext);
|
||||
List<SiblingPipelineAggregator> pipelineAggregators = firstResult.pipelineAggregators();
|
||||
if (pipelineAggregators != null) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TransportSearchAction extends HandledTransportAction<SearchRequest,
|
|||
ClusterService clusterService, ActionFilters actionFilters, IndexNameExpressionResolver
|
||||
indexNameExpressionResolver) {
|
||||
super(settings, SearchAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, SearchRequest::new);
|
||||
this.searchPhaseController = new SearchPhaseController(settings, bigArrays, scriptService, clusterService);;
|
||||
this.searchPhaseController = new SearchPhaseController(settings, bigArrays, scriptService);
|
||||
this.searchTransportService = new SearchTransportService(settings, transportService);
|
||||
SearchTransportService.registerRequestHandler(transportService, searchService);
|
||||
this.clusterService = clusterService;
|
||||
|
|
|
@ -50,10 +50,9 @@ public class TransportSearchScrollAction extends HandledTransportAction<SearchSc
|
|||
SearchScrollRequest::new);
|
||||
this.clusterService = clusterService;
|
||||
this.searchTransportService = new SearchTransportService(settings, transportService);
|
||||
this.searchPhaseController = new SearchPhaseController(settings, bigArrays, scriptService, clusterService);
|
||||
this.searchPhaseController = new SearchPhaseController(settings, bigArrays, scriptService);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected final void doExecute(SearchScrollRequest request, ActionListener<SearchResponse> listener) {
|
||||
throw new UnsupportedOperationException("the task parameter is required");
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.elasticsearch.search.aggregations;
|
||||
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteable;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
|
@ -69,12 +68,10 @@ public abstract class InternalAggregation implements Aggregation, ToXContent, Na
|
|||
|
||||
private final BigArrays bigArrays;
|
||||
private final ScriptService scriptService;
|
||||
private final ClusterState clusterState;
|
||||
|
||||
public ReduceContext(BigArrays bigArrays, ScriptService scriptService, ClusterState clusterState) {
|
||||
public ReduceContext(BigArrays bigArrays, ScriptService scriptService) {
|
||||
this.bigArrays = bigArrays;
|
||||
this.scriptService = scriptService;
|
||||
this.clusterState = clusterState;
|
||||
}
|
||||
|
||||
public BigArrays bigArrays() {
|
||||
|
@ -84,10 +81,6 @@ public abstract class InternalAggregation implements Aggregation, ToXContent, Na
|
|||
public ScriptService scriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
public ClusterState clusterState() {
|
||||
return clusterState;
|
||||
}
|
||||
}
|
||||
|
||||
protected final String name;
|
||||
|
@ -126,7 +119,6 @@ public abstract class InternalAggregation implements Aggregation, ToXContent, Na
|
|||
|
||||
protected abstract void doWriteTo(StreamOutput out) throws IOException;
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
|
@ -215,5 +207,4 @@ public abstract class InternalAggregation implements Aggregation, ToXContent, Na
|
|||
public static final String TO = "to";
|
||||
public static final String TO_AS_STRING = "to_as_string";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.action.search;
|
|||
|
||||
import org.apache.lucene.search.ScoreDoc;
|
||||
import org.apache.lucene.search.TopDocs;
|
||||
import org.elasticsearch.action.search.SearchPhaseController;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.text.Text;
|
||||
import org.elasticsearch.common.util.BigArrays;
|
||||
|
@ -57,7 +56,7 @@ public class SearchPhaseControllerTests extends ESTestCase {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
searchPhaseController = new SearchPhaseController(Settings.EMPTY, BigArrays.NON_RECYCLING_INSTANCE, null, null);
|
||||
searchPhaseController = new SearchPhaseController(Settings.EMPTY, BigArrays.NON_RECYCLING_INSTANCE, null);
|
||||
}
|
||||
|
||||
public void testSort() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue