hoangsonww / hoangsonww/Library-Management-Backend
Add full-text search for books and authors
- Dominant language
- Go
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## What problem does this solve?
`GET /api/v1/books` and `/authors` filter on exact/prefix fields (`genre`, `authorId`, etc. per the README) but there's no free-text search across titles/author names/bios — a borrower who half-remembers a title has no good way to find it.
## Proposed solution
- Add a `?q=` query param on `GET /api/v1/books` and `/api/v1/authors` that does a `LIKE '%...%'` (case-insensitive, via SQLite's `COLLATE NOCASE`) match across `title` (and `author.name` via a join) for books, and `name`/`bio` for authors.
- Given SQLite's pure-Go driver here, consider SQLite's built-in [FTS5](https://www.sqlite.org/fts5.html) virtual table for better relevance/ranking than a plain `LIKE`, if the added complexity is worth it — otherwise `LIKE` is a fine, simple starting point given the expected catalog size.
- Add `books search ` / `authors search ` CLI subcommands.
## Alternatives considered
Requiring exact title match — the current de facto behavior — which is a poor experience for anyone who doesn't remember a title verbatim.
## Area
Books, Authors
## Priority
Would significantly improve day-to-day usability of the catalog browsing experience.
Contributor guide
Assessment
This issue has not been assessed yet.