Skip to content

Add offset-based pagination to search API#76

Merged
windoze95 merged 2 commits intomainfrom
feat/search-pagination
Apr 5, 2026
Merged

Add offset-based pagination to search API#76
windoze95 merged 2 commits intomainfrom
feat/search-pagination

Conversation

@windoze95
Copy link
Copy Markdown
Owner

Summary

  • Adds offset query parameter (0-200) and has_more response field to GET /v1/recipes/search
  • Paginated requests (offset > 0) bypass cache and don't count against search quota
  • HasMore derived from whether the result count equals the requested count

Test plan

  • All existing tests updated and passing
  • New tests: offset bypasses cache, HasMore true/false, invalid offset returns 400, has_more in response, offset parsed correctly
  • Deploy and verify pagination with the frontend PR (windoze95/saltybytes-app feat/search-pagination)

🤖 Generated with Claude Code

Search results previously returned a fixed batch with no way to fetch
more. This adds an `offset` query parameter and `has_more` response
field so the frontend can paginate seamlessly. Paginated requests
bypass the cache (only first-page results are cached) and do not
count against the user's search quota.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8d5e3af0f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/handlers/search.go Outdated
Comment thread internal/service/search.go Outdated
…providers

- Remove offset==0 guard on usage increment so paginated requests
  also count against quota, preventing free-tier bypass via offset>0.
- Derive HasMore using min(count, maxProviderPageSize) so requests
  with count>20 don't falsely report no more results when Brave
  caps at 20.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@windoze95 windoze95 merged commit 39cfe62 into main Apr 5, 2026
1 check passed
@windoze95 windoze95 deleted the feat/search-pagination branch April 5, 2026 20:59
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