more generic?
This commit is contained in:
parent
d113b59e86
commit
6754a26d08
|
@ -45,7 +45,7 @@ import java.util.Map;
|
|||
public class FieldDataFieldsFetchSubPhase implements FetchSubPhase {
|
||||
|
||||
public static final String[] NAMES = {"fielddata_fields", "fielddataFields"};
|
||||
public static final ContextFactory CONTEXT_FACTORY = new ContextFactory() {
|
||||
public static final ContextFactory<FieldDataFieldsContext> CONTEXT_FACTORY = new ContextFactory<FieldDataFieldsContext>() {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -53,7 +53,7 @@ public class FieldDataFieldsFetchSubPhase implements FetchSubPhase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FetchSubPhaseContext newContextInstance() {
|
||||
public FieldDataFieldsContext newContextInstance() {
|
||||
return new FieldDataFieldsContext();
|
||||
}
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ public class FieldDataFieldsFetchSubPhase implements FetchSubPhase {
|
|||
|
||||
@Override
|
||||
public void hitExecute(SearchContext context, HitContext hitContext) {
|
||||
for (FieldDataFieldsContext.FieldDataField field : ((FieldDataFieldsContext)context.getFetchSubPhaseContext(CONTEXT_FACTORY)).fields()) {
|
||||
for (FieldDataFieldsContext.FieldDataField field : context.getFetchSubPhaseContext(CONTEXT_FACTORY).fields()) {
|
||||
if (hitContext.hit().fieldsOrNull() == null) {
|
||||
hitContext.hit().fields(new HashMap<String, SearchHitField>(2));
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public class FetchSubPhasePluginTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
public static class TermVectorsFetchSubPhase implements FetchSubPhase {
|
||||
|
||||
public static final ContextFactory CONTEXT_FACTORY = new ContextFactory() {
|
||||
public static final ContextFactory<TermVectorsFetchContext> CONTEXT_FACTORY = new ContextFactory<TermVectorsFetchContext>() {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -125,7 +125,7 @@ public class FetchSubPhasePluginTests extends ElasticsearchIntegrationTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FetchSubPhaseContext newContextInstance() {
|
||||
public TermVectorsFetchContext newContextInstance() {
|
||||
return new TermVectorsFetchContext();
|
||||
}
|
||||
};
|
||||
|
@ -158,7 +158,7 @@ public class FetchSubPhasePluginTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Override
|
||||
public void hitExecute(SearchContext context, HitContext hitContext) {
|
||||
String field = ((TermVectorsFetchContext) context.getFetchSubPhaseContext(CONTEXT_FACTORY)).getField();
|
||||
String field = context.getFetchSubPhaseContext(CONTEXT_FACTORY).getField();
|
||||
|
||||
if (hitContext.hit().fieldsOrNull() == null) {
|
||||
hitContext.hit().fields(new HashMap<String, SearchHitField>());
|
||||
|
|
Loading…
Reference in New Issue