Skip to content

Commit

Permalink
Merge pull request #43 from philbudne/end-of-page
Browse files Browse the repository at this point in the history
OnlineNewsMediaCloudESProvider: return page_token === None for end of pages!!!
  • Loading branch information
philbudne authored Jan 25, 2025
2 parents 40b08d7 + 2f86ea9 commit 34e9bc5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mc_providers/onlinenews.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,14 +1250,13 @@ def paged_items(

hits = self._search_hits(search)
if not hits:
return ([], "")
return ([], None)

new_pt: str | None = None
if len(hits) == page_size:
# generate paging token from all sort keys of last item:
new_pt = _b64_encode_page_token(
_SORT_KEY_SEP.join([str(key) for key in hits[-1].meta.sort]))
else:
new_pt = ""

# double conversion!
rows = self._matches_to_rows([_format_match(h, expanded) for h in hits])
Expand Down

0 comments on commit 34e9bc5

Please sign in to comment.