API Change: search sort
This commit is contained in:
parent
3a59397306
commit
7c93c1915f
|
@ -85,6 +85,23 @@ public class SortParseElement implements SearchParseElement {
|
|||
boolean reverse = false;
|
||||
String innerJsonName = null;
|
||||
int type = -1;
|
||||
token = jp.nextToken();
|
||||
if (token == JsonToken.VALUE_STRING) {
|
||||
String direction = jp.getText();
|
||||
if (direction.equals("asc")) {
|
||||
if ("score".equals(fieldName)) {
|
||||
reverse = true;
|
||||
} else {
|
||||
reverse = false;
|
||||
}
|
||||
} else if (direction.equals("desc")) {
|
||||
if ("score".equals(fieldName)) {
|
||||
reverse = false;
|
||||
} else {
|
||||
reverse = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while ((token = jp.nextToken()) != JsonToken.END_OBJECT) {
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
innerJsonName = jp.getCurrentName();
|
||||
|
@ -107,6 +124,7 @@ public class SortParseElement implements SearchParseElement {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
addSortField(context, sortFields, fieldName, reverse, type);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue