fix to sort parsing in SearchService

This commit is contained in:
Colin Goodheart-Smithe 2015-09-23 17:33:05 +01:00
parent 585ed07c5b
commit 52d9664993
1 changed files with 5 additions and 1 deletions

View File

@ -695,16 +695,20 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
XContentParser completeSortParser = null;
try {
XContentBuilder completeSortBuilder = XContentFactory.jsonBuilder();
completeSortBuilder.startArray();
completeSortBuilder.startObject();
completeSortBuilder.startArray("sort");
for (BytesReference sort : source.sorts()) {
XContentParser parser = XContentFactory.xContent(sort).createParser(sort);
parser.nextToken();
completeSortBuilder.copyCurrentStructure(parser);
}
completeSortBuilder.endArray();
completeSortBuilder.endObject();
BytesReference completeSortBytes = completeSortBuilder.bytes();
completeSortParser = XContentFactory.xContent(completeSortBytes).createParser(completeSortBytes);
completeSortParser.nextToken();
completeSortParser.nextToken();
completeSortParser.nextToken();
this.elementParsers.get("sort").parse(completeSortParser, context);
} catch (Exception e) {
String sSource = "_na_";