feat(search-api-graphql)!: group result pagination into a shared Pagination type - #673
Merged
Conversation
…nation type
- serve items / pagination / facets: total, page and perPage now live in one
Pagination object shared across every TypeSearchResult, so a single client
pager fragment serves all root types
- keep the page and perPage arguments flat: GraphQL has no input fragments,
so an input object would group them without the reuse payoff
- update the reference docs, the build-a-search-api guide and the ADR 4 SDL
sketch accordingly
BREAKING CHANGE: the result envelope fields total, page and perPage moved
into a pagination object; select pagination { total page perPage } instead.
ddeboer
enabled auto-merge (squash)
July 28, 2026 19:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Groups the search result envelope’s pagination fields into a single shared
Paginationtype. Every‹Type›SearchResultnow servesitems/pagination/facets:Why
total/page/perPagewere stamped into every per-type result type, so a client pager could not share one fragment across root types. With one shared type,fragment Pager on Pagination { total page perPage }serves them all.totalPages,hasNextPage) get an obvious home later, instead of piling onto the result root next toitemsandfacets.The request arguments deliberately stay flat (
page,perPage): GraphQL has no input fragments, so apaginationinput object would add nesting without the reuse payoff. A Relay-style connection was considered and rejected – Typesense is natively offset-based, so cursors could only wrap offsets without cursor-stability guarantees, and a page-numbered faceted search UI wants totals and arbitrary page jumps (see ADR 3/4).Changes
build-schema.ts: build one sharedPaginationobject type; nest the applied pagination in the resolver result.Paginationis emitted once and referenced by every result type.search-api-graphqlreference, sample queries in the build-a-search-api guide, and the ADR 4 SDL sketch (including the flat-arguments rationale).Breaking change (minor bump under the zero-major scheme): clients selecting
total,pageorperPageat the result root must selectpagination { total page perPage }instead. Known downstream: LOL’s search frontend and guide queries.