fix to sort parsing in SearchService
This commit is contained in:
parent
585ed07c5b
commit
52d9664993
|
@ -695,16 +695,20 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
||||||
XContentParser completeSortParser = null;
|
XContentParser completeSortParser = null;
|
||||||
try {
|
try {
|
||||||
XContentBuilder completeSortBuilder = XContentFactory.jsonBuilder();
|
XContentBuilder completeSortBuilder = XContentFactory.jsonBuilder();
|
||||||
completeSortBuilder.startArray();
|
completeSortBuilder.startObject();
|
||||||
|
completeSortBuilder.startArray("sort");
|
||||||
for (BytesReference sort : source.sorts()) {
|
for (BytesReference sort : source.sorts()) {
|
||||||
XContentParser parser = XContentFactory.xContent(sort).createParser(sort);
|
XContentParser parser = XContentFactory.xContent(sort).createParser(sort);
|
||||||
parser.nextToken();
|
parser.nextToken();
|
||||||
completeSortBuilder.copyCurrentStructure(parser);
|
completeSortBuilder.copyCurrentStructure(parser);
|
||||||
}
|
}
|
||||||
completeSortBuilder.endArray();
|
completeSortBuilder.endArray();
|
||||||
|
completeSortBuilder.endObject();
|
||||||
BytesReference completeSortBytes = completeSortBuilder.bytes();
|
BytesReference completeSortBytes = completeSortBuilder.bytes();
|
||||||
completeSortParser = XContentFactory.xContent(completeSortBytes).createParser(completeSortBytes);
|
completeSortParser = XContentFactory.xContent(completeSortBytes).createParser(completeSortBytes);
|
||||||
completeSortParser.nextToken();
|
completeSortParser.nextToken();
|
||||||
|
completeSortParser.nextToken();
|
||||||
|
completeSortParser.nextToken();
|
||||||
this.elementParsers.get("sort").parse(completeSortParser, context);
|
this.elementParsers.get("sort").parse(completeSortParser, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String sSource = "_na_";
|
String sSource = "_na_";
|
||||||
|
|
Loading…
Reference in New Issue