generic for sub classes also?
This commit is contained in:
parent
6754a26d08
commit
b86d07fc9a
|
@ -285,12 +285,12 @@ public class PercolateContext extends SearchContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FetchSubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory contextFactory) {
|
||||
public <SubPhaseContext extends FetchSubPhaseContext> SubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory<SubPhaseContext> contextFactory) {
|
||||
String subPhaseName = contextFactory.getName();
|
||||
if (subPhaseContexts.get(subPhaseName) == null) {
|
||||
subPhaseContexts.put(subPhaseName, contextFactory.newContextInstance());
|
||||
}
|
||||
return subPhaseContexts.get(subPhaseName);
|
||||
return (SubPhaseContext) subPhaseContexts.get(subPhaseName);
|
||||
}
|
||||
|
||||
// Unused:
|
||||
|
|
|
@ -129,10 +129,10 @@ public class DefaultSearchContext extends SearchContext {
|
|||
private final Map<String, FetchSubPhaseContext> subPhaseContexts = new HashMap<>();
|
||||
|
||||
public DefaultSearchContext(long id, ShardSearchRequest request, SearchShardTarget shardTarget,
|
||||
Engine.Searcher engineSearcher, IndexService indexService, IndexShard indexShard,
|
||||
ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
|
||||
BigArrays bigArrays, Counter timeEstimateCounter, ParseFieldMatcher parseFieldMatcher,
|
||||
TimeValue timeout
|
||||
Engine.Searcher engineSearcher, IndexService indexService, IndexShard indexShard,
|
||||
ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
|
||||
BigArrays bigArrays, Counter timeEstimateCounter, ParseFieldMatcher parseFieldMatcher,
|
||||
TimeValue timeout
|
||||
) {
|
||||
super(parseFieldMatcher);
|
||||
this.id = id;
|
||||
|
@ -305,14 +305,15 @@ public class DefaultSearchContext extends SearchContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FetchSubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory contextFactory) {
|
||||
public <SubPhaseContext extends FetchSubPhaseContext> SubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory<SubPhaseContext> contextFactory) {
|
||||
String subPhaseName = contextFactory.getName();
|
||||
if (subPhaseContexts.get(subPhaseName) == null) {
|
||||
subPhaseContexts.put(subPhaseName, contextFactory.newContextInstance());
|
||||
}
|
||||
return subPhaseContexts.get(subPhaseName);
|
||||
return (SubPhaseContext) subPhaseContexts.get(subPhaseName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SearchContextHighlight highlight() {
|
||||
return highlight;
|
||||
|
|
|
@ -621,7 +621,7 @@ public abstract class FilteredSearchContext extends SearchContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FetchSubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory subPhase) {
|
||||
return in.getFetchSubPhaseContext(subPhase);
|
||||
public <SubPhaseContext extends FetchSubPhaseContext> SubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory<SubPhaseContext> contextFactory) {
|
||||
return in.getFetchSubPhaseContext(contextFactory);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,12 +204,12 @@ public class TestSearchContext extends SearchContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FetchSubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory contextFactory) {
|
||||
public <SubPhaseContext extends FetchSubPhaseContext> SubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory<SubPhaseContext> contextFactory) {
|
||||
String subPhaseName = contextFactory.getName();
|
||||
if (subPhaseContexts.get(subPhaseName) == null) {
|
||||
subPhaseContexts.put(subPhaseName, contextFactory.newContextInstance());
|
||||
}
|
||||
return subPhaseContexts.get(subPhaseName);
|
||||
return (SubPhaseContext) subPhaseContexts.get(subPhaseName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue