| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The objects_count query reused the same SELECT that already had LIMIT/OFFSET applied, so count() always returned at most page_size rows, making totalPages always 1 regardless of actual row count. Build a separate count query with only filters and joins (no pagination) so that totalPages reflects the true number of pages. Closes mts-ai#103 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
Summary
Fixes #103 — totalPages always returns 1 regardless of actual row count when using page[size] pagination.
Root cause: get_collection() in orm.py builds a query with LIMIT/OFFSET (pagination), then passes the same query to count(). Since count() wraps the query as a subquery, the LIMIT caps the row count to at most page_size, so totalPages = ceil(page_size / page_size) = 1.
Fix: Build a separate count query with only filters and joins (no size/number pagination params). This ensures count() returns the total number of matching rows across all pages.
Test plan
🤖 Generated with Claude Code