mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-18 10:54:54 +00:00
Use type information in request
Adds parsing of type and actually using it in TransportRankEvalAction. Missing: A good idea how to actually test this in isolation...
This commit is contained in:
parent
2bb5cb83a7
commit
ad9f060dc7
@ -225,10 +225,13 @@ public class RestRankEvalAction extends BaseRestHandler {
|
|||||||
public static void parseRankEvalRequest(RankEvalRequest rankEvalRequest, RestRequest request, RankEvalContext context)
|
public static void parseRankEvalRequest(RankEvalRequest rankEvalRequest, RestRequest request, RankEvalContext context)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
List<String> indices = Arrays.asList(Strings.splitStringByCommaToArray(request.param("index")));
|
List<String> indices = Arrays.asList(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
|
List<String> types = Arrays.asList(Strings.splitStringByCommaToArray(request.param("type")));
|
||||||
RankEvalSpec spec = PARSER.parse(context.parser(), context);
|
RankEvalSpec spec = PARSER.parse(context.parser(), context);
|
||||||
for (QuerySpec specification : spec.getSpecifications()) {
|
for (QuerySpec specification : spec.getSpecifications()) {
|
||||||
specification.setIndices(indices);
|
specification.setIndices(indices);
|
||||||
|
specification.setTypes(types);
|
||||||
};
|
};
|
||||||
|
|
||||||
rankEvalRequest.setRankEvalSpec(spec);
|
rankEvalRequest.setRankEvalSpec(spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,9 @@ public class TransportRankEvalAction extends HandledTransportAction<RankEvalRequ
|
|||||||
String[] indices = new String[spec.getIndices().size()];
|
String[] indices = new String[spec.getIndices().size()];
|
||||||
spec.getIndices().toArray(indices);
|
spec.getIndices().toArray(indices);
|
||||||
SearchRequest templatedRequest = new SearchRequest(indices, specRequest);
|
SearchRequest templatedRequest = new SearchRequest(indices, specRequest);
|
||||||
|
String[] types = new String[spec.getTypes().size()];
|
||||||
|
spec.getTypes().toArray(types);
|
||||||
|
templatedRequest.types(types);
|
||||||
|
|
||||||
TransportSearchAction transportSearchAction = new TransportSearchAction(settings, threadPool, searchPhaseController,
|
TransportSearchAction transportSearchAction = new TransportSearchAction(settings, threadPool, searchPhaseController,
|
||||||
transportService, searchTransportService, clusterService, actionFilters, indexNameExpressionResolver);
|
transportService, searchTransportService, clusterService, actionFilters, indexNameExpressionResolver);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user