Skip to content

Commit

Permalink
fix sort by string when the value is null
Browse files Browse the repository at this point in the history
  • Loading branch information
taoyyu committed Feb 4, 2025
1 parent 45a2942 commit f25d98d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ private static SearchResponse.Hit.CompositeFieldValue getValueForSortField(
break;
case STRING:
case STRING_VAL:
if (sortValue instanceof BytesRef) {
if (sortValue == null) {
fieldValue.setTextValue("");
} else if (sortValue instanceof BytesRef) {
fieldValue.setTextValue(((BytesRef) sortValue).utf8ToString());
} else {
fieldValue.setTextValue((String) sortValue);
Expand Down

0 comments on commit f25d98d

Please sign in to comment.