Skip to content

Commit

Permalink
More sorting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
munrojm committed Jun 11, 2024
1 parent 524bd97 commit 2084227
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/maggma/api/query_operator/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def query(
)

for sort_field in field_list:
query_entry = {sort_field[1:]: -1} if sort_field.startswith("-") else {sort_field: 1}
query_entry = {sort_field: 1}

if sort_field.startswith("-"):
query_entry = {sort_field[1:]: -1}
sort_field = sort_field[1:]

if self.fields and sort_field not in self.fields:
continue
Expand Down

0 comments on commit 2084227

Please sign in to comment.