Skip to content

Commit

Permalink
Fix desc sorting in query op
Browse files Browse the repository at this point in the history
  • Loading branch information
munrojm committed Jun 11, 2024
1 parent 786c331 commit 524bd97
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/maggma/api/query_operator/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ def query(
)

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

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

if sort_field[0] == "-":
sort.update({sort_field[1:]: -1})
else:
sort.update({sort_field: 1})
sort.update(query_entry)

return {"sort": sort}

0 comments on commit 524bd97

Please sign in to comment.