Skip to content

Commit

Permalink
Bugfix - add unmapped type for missing sort fields
Browse files Browse the repository at this point in the history
  • Loading branch information
meek0 committed Oct 31, 2017
1 parent 2263708 commit 22d7703
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,10 @@ public List<SortBuilder> visit(ASTNode node) {
List<SortBuilder> sortBuilders = Lists.newArrayList();
if (node.getArgumentsSize() >= 1) {
for(int i = 0; i < node.getArgumentsSize(); i++) {
sortBuilders.add(processArgument(node.getArgument(i).toString()));
SortBuilder sortBuilder = processArgument(node.getArgument(i).toString());
((FieldSortBuilder) sortBuilder).unmappedType("string");
sortBuilder.missing("_last");
sortBuilders.add(sortBuilder);
}
}
return sortBuilders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ public void test_rql_query_term_and_limit_and_sort() throws IOException {
assertThat(rqlQueryWrapper.getSize()).isEqualTo(4);
String expectedSort = "\n" +
"\"name\"{\n" +
" \"order\" : \"desc\"\n" +
" \"order\" : \"desc\",\n" +
" \"missing\" : \"_last\",\n" +
" \"unmapped_type\" : \"string\"\n" +
"}";
assertThat(rqlQueryWrapper.getSortBuilders().get(0).toString()).isEqualTo(expectedSort);
}
Expand Down

0 comments on commit 22d7703

Please sign in to comment.