Skip to content

fix(provider-met): search through the paginated v1.1 endpoint - #31

Merged
MyPrototypeWhat merged 1 commit into
mainfrom
fix/met-v1.1-search
Oct 10, 2026
Merged

MyPrototypeWhat merged 1 commit into
mainfrom
fix/met-v1.1-search

Conversation

@MyPrototypeWhat

Copy link
Copy Markdown
Collaborator

The Met retired GET /public/collection/v1/search on 2026-10-01. It now answers 410 Gone, so every Met search failed. The weekly live-smoke run on 2026-10-05 caught it as met search failed: 410.

Change

  • Search goes to /public/collection/v1.1/search. According to the Met's migration notes, it accepts every v1 filter unchanged and keeps the { total, objectIDs } shape. It adds offset and limit and returns one page of IDs.
  • The provider asks for exactly the page it needs. offset comes from the requested page, and limit is the per-search object count, capped at 30 as before. Previously it downloaded every matching ID and sliced a window out of it. Keeping that slice on top of offset would have made every page after the first come back empty, and a test now pins this.
  • Object records still come from /v1/objects/{id}, which is unchanged. All providerOptions filters are forwarded as before.
  • Patch changeset for @refkit/provider-met.

Upstream behaviour checked live

  • Consecutive pages are consistent: offset=0&limit=3 followed by offset=3&limit=3 returns the same IDs as offset=0&limit=6.
  • No match, or an offset past total, returns objectIDs: null with status 200. The existing empty-result path handles it.
  • limit above 500 is capped, and offset + limit is truncated at 10,000 without an error. The provider asks for at most 30 per page.

Testing

  • Three new unit tests:

    • The search goes to v1.1 with offset/limit, and objects come from v1.
    • Page 3 sends offset=4/limit=2 and maps every ID the page returns.
    • Object fetches stay bounded to one page.

    The first two failed on main and pass now.

  • REFKIT_LIVE=1 Met live smoke passes against the real API.

  • Full gate: pnpm typecheck, pnpm lint, pnpm build, pnpm test:run (519 passed, 23 skipped), pnpm smoke:artifact.

Note: the Met often returns few usable results for a query. Many hits are copyrighted works whose images the Met does not release, and the provider drops those as before. For example, on the first two 4-ID pages for "lighthouse", only one object is public-domain with an image. This is unchanged by this PR.

The Met retired /public/collection/v1/search on 2026-10-01 (410 Gone),
which failed every Met search and the weekly live smoke. /v1.1/search
takes the same filters plus offset/limit and returns one page of ids,
so request exactly the page instead of windowing a full id list.
Object records stay on /v1/objects/{id}.
@MyPrototypeWhat
MyPrototypeWhat merged commit f206333 into main Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant