Skip to content

Commit

Permalink
service: add sort to read_many
Browse files Browse the repository at this point in the history
  • Loading branch information
jrcastro2 authored and zzacharo committed Sep 13, 2023
1 parent 192f9b1 commit e2fca47
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions invenio_records_resources/services/records/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def _read_many(
search_opts=None,
extra_filter=None,
preference=None,
sort=None,
**kwargs,
):
"""Search for records matching the ids."""
Expand All @@ -424,8 +425,10 @@ def _read_many(
# method instead for now.
search = search.source(fields)

search = search[0:max_records]
search_result = search.query(search_query).execute()
search = search[0:max_records].query(search_query)
if sort:
search = search.sort(sort)
search_result = search.execute()

return search_result

Expand Down

0 comments on commit e2fca47

Please sign in to comment.