Skip to content

Commit

Permalink
Try to match initial offset behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Mar 14, 2023
1 parent 989e0ee commit e424b05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions optimade/server/entry_collections/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def _run_db_query(
search = search.extra(search_after=page_above, limit=limit)

else:
search = search[:limit]
search = search[0:limit]
page_offset = 0

search = search.extra(track_total_hits=True)
response = search.execute()
Expand All @@ -204,7 +205,7 @@ def _run_db_query(

if not single_entry:
data_returned = response.hits.total.value
if page_offset:
if page_offset is not None:
more_data_available = page_offset + limit < data_returned
else:
# Needs to be set by some custom elastic query: is the ID the last ID?
Expand Down

0 comments on commit e424b05

Please sign in to comment.