Skip to content

Commit 4664f85

Browse files
nikazzioCopilot
andcommitted
fix: align pagination offset with displayed page size
Archive.org: set rows=requested_results instead of 3x overfetch — inline probing is gone so the overfetch is unnecessary. API page now advances cleanly by the displayed page size. Harvard: remove requested_results cap on deduped results so all valid IIIF items found in each API batch are returned. The 10x overfetch scans the full batch; capping silently dropped reachable items. LOC: same fix — remove the requested_results break so all valid items from each 5x overfetch batch are shown to the user. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8b14038 commit 4664f85

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

src/universal_iiif_core/resolvers/discovery.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,10 @@ def search_archive_org(query: str, max_results: int = 20, page: int = 1) -> list
425425

426426
clean_q = q.replace('"', " ")
427427
requested_results = max(1, min(max_results, 50))
428-
fetch_rows = min(max(requested_results * 3, 20), 60)
429428
params = {
430429
"q": f"({clean_q}) AND mediatype:texts",
431430
"fl[]": ["identifier", "title", "creator", "date", "mediatype", "description", "volume", "language"],
432-
"rows": str(fetch_rows),
431+
"rows": str(requested_results),
433432
"page": str(max(1, page)),
434433
"output": "json",
435434
}
@@ -678,8 +677,6 @@ def search_harvard(query: str, max_results: int = 20, page: int = 1) -> list[Sea
678677
continue
679678
seen_ids.add(doc_id)
680679
deduped.append(item)
681-
if len(deduped) >= requested_results:
682-
break
683680
return deduped
684681

685682

@@ -722,8 +719,6 @@ def search_loc(query: str, max_results: int = 20, page: int = 1) -> list[SearchR
722719
"raw": {"viewer_url": viewer_url},
723720
}
724721
)
725-
if len(results) >= requested_results:
726-
break
727722
return results
728723

729724

0 commit comments

Comments
 (0)