Skip to content

docs(creators): totalItems/totalPages are lower bounds on ?query= search - #5

Open
ZacxDev wants to merge 1 commit into
mainfrom
zach/creators-query-count-lower-bound
Open

docs(creators): totalItems/totalPages are lower bounds on ?query= search#5
ZacxDev wants to merge 1 commit into
mainfrom
zach/creators-query-count-lower-bound

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What

Documents a behaviour change from civitai #3097 for external consumers of GET /api/v1/creators.

On the ?query= search path, the endpoint no longer returns an exact total. #3097 dropped the pathological exact COUNT (username LIKE '%q%'models: { some: {} } — a leading-wildcard scan of the ~900k-row Model table, ~800ms–1.4s on every keystroke request, ~53,000s of replica CPU / 37d in prod) in favour of a take+1 hasMore probe.

Consequences documented:

  • metadata.totalItems / metadata.totalPages are monotonic lower bounds on the query path (exact only on the final page).
  • metadata.nextPage is the authoritative "another page exists" signal — consumers should follow it rather than compute currentPage < totalPages.
  • The unfiltered listing (no query) is unchanged — still an exact (cached) count.

Why

Existing docs recommend ?query= prefix-walking for deep traversal, so external consumers paging that path need to know the totals are now bounds and nextPage is the correct pagination signal.

Docs-only; no code.

…= search

The /api/v1/creators search path (civitai #3097) dropped the pathological exact
COUNT (username LIKE '%q%' ∩ has-models: ~800ms-1.4s per keystroke request) in
favour of a take+1 hasMore probe. On the query path totalItems/totalPages are
now monotonic lower bounds (exact on the final page); nextPage is the
authoritative next-page signal. The unfiltered listing keeps its exact cached
count. Document this for external API consumers.
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