mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
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 class FieldDataFieldsFetchSubPhase implements FetchSubPhase {
|
||||||
|
|
||||||
public static final String[] NAMES = {"fielddata_fields", "fielddataFields"};
|
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
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -53,7 +53,7 @@ public class FieldDataFieldsFetchSubPhase implements FetchSubPhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FetchSubPhaseContext newContextInstance() {
|
public FieldDataFieldsContext newContextInstance() {
|
||||||
return new FieldDataFieldsContext();
|
return new FieldDataFieldsContext();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -86,7 +86,7 @@ public class FieldDataFieldsFetchSubPhase implements FetchSubPhase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hitExecute(SearchContext context, HitContext hitContext) {
|
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) {
|
if (hitContext.hit().fieldsOrNull() == null) {
|
||||||
hitContext.hit().fields(new HashMap<String, SearchHitField>(2));
|
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 class TermVectorsFetchSubPhase implements FetchSubPhase {
|
||||||
|
|
||||||
public static final ContextFactory CONTEXT_FACTORY = new ContextFactory() {
|
public static final ContextFactory<TermVectorsFetchContext> CONTEXT_FACTORY = new ContextFactory<TermVectorsFetchContext>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -125,7 +125,7 @@ public class FetchSubPhasePluginTests extends ElasticsearchIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FetchSubPhaseContext newContextInstance() {
|
public TermVectorsFetchContext newContextInstance() {
|
||||||
return new TermVectorsFetchContext();
|
return new TermVectorsFetchContext();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -158,7 +158,7 @@ public class FetchSubPhasePluginTests extends ElasticsearchIntegrationTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hitExecute(SearchContext context, HitContext hitContext) {
|
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) {
|
if (hitContext.hit().fieldsOrNull() == null) {
|
||||||
hitContext.hit().fields(new HashMap<String, SearchHitField>());
|
hitContext.hit().fields(new HashMap<String, SearchHitField>());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user