Skip to content

Implement search for books - #43

Open
vanadium23 wants to merge 8 commits into
mainfrom
ralph-20260305-134458-0881
Open

Implement search for books#43
vanadium23 wants to merge 8 commits into
mainfrom
ralph-20260305-134458-0881

Conversation

@vanadium23

Copy link
Copy Markdown
Owner

No description provided.

Ralph Bot and others added 8 commits March 5, 2026 13:49
- Add SearchQuery struct with search, sort, order, page, limit fields
- Update BookRepo and Shelf interfaces with Search and SearchCount methods
- Implement ILIKE-based search across title, author, series, description
- Add sorting support for title, author, series, created_at fields
- Handle NULL series values correctly in sort (sorted last)
- Support multi-word search with AND logic

Task: fn-4-add-book-search-and-filter.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update Shelf interface to use SearchQuery for ListBooks method
- Remove separate SearchBooks method (now unified with ListBooks)
- Add normalizeSearchQuery helper for validation and defaults
- Invalid sort fields default to "title", invalid orders to "asc"
- Empty search query returns all books (backward compatibility)
- Update web and OPDS controllers to use new interface

Task: fn-4-add-book-search-and-filter.2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add search input with placeholder text and submit button
- Add sort dropdown (date added, title, author, series)
- Add order toggle (ascending/descending)
- Sort dropdown auto-submits on change for instant filtering
- Add "No books found" message with clear search link
- Preserve search/sort params in pagination links (shareable URLs)
- Add CSS styles for search controls matching existing design

Task: fn-4-add-book-search-and-filter.3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create new books.go with GET /api/v1/books endpoint
- Add search, sort, order, page, limit query parameters
- Return paginated JSON response with books and pagination metadata
- Update router.go to register API v1 routes

Task: fn-4-add-book-search-and-filter.4
- Parse search query parameter in listNewest handler
- Pass search query to ListBooks via SearchQuery struct
- Update formNavLinks to preserve search in pagination links
- Update feed title and self URL to reflect search state

Task: fn-4-add-book-search-and-filter.5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add error.html template for panic recovery
- Pin postgres to version 16 in docker-compose for compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author, publisher, isbn, cover_path, and series columns can be NULL
in the database but were scanned into non-nullable string fields.
Changed to use sql.NullString for these fields in List, GetById,
GetByFileHash, and Search methods.

Fixes 500 error on /books/ page when database contains NULL values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vanadium23
vanadium23 force-pushed the ralph-20260305-134458-0881 branch from bc01772 to f912a34 Compare March 19, 2026 14:40
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