> Only a step. Next step of the Repair epic, #1080. The search belongs in the backend later (#1076): this PR gathers the frontend's search rules in one place until then, with no change on screen.
Summary
Every screen that searched for a book reached the search its own way: Add New's rules sat in its useSearch composable and its advanced form in the page, the book card joined its title and author into TITLE:… AUTHOR:… tokens only for that parser to split them again, and Start Matching called the API from its store. This PR moves all of it into one module, services/audiobookSearch.ts: no book search calls the API from anywhere else. When the search moves to the backend, that move starts from one file.
Requests don't change, apart from the two points under Behaviour that changes. An earlier version of this PR replaced the card's fields with Add New's search box. That is dropped: the tokens are less friendly and made searches harder, and the fields already map to what the search takes.
Changes
Added
services/audiobookSearch.ts, the search's rules:
- what a query is:
ASIN:,ISBN:,TITLE:andAUTHOR:prefixes first, then an ISBN-13, then an ASIN or ISBN-10, else a title; - the
TITLE:,AUTHOR:,ASIN:,SERIES:andISBN:tokens (values of several words); - where each kind is searched: an ASIN through the metadata endpoint, which tries the enabled metadata sources in their priority order; an
ISBN:through the advanced search, a bare ISBN through the simple one; a title through the advanced search; - the region, its language filter, and the number of results (or Start Matching's pool of candidates);
- Add New's advanced form: a series alone looked up as a series, an author's books filtered on the series, or all of them when none is in it;
- the results a search can use: Audible's empty records dropped, each result tagged with its region;
- the metadata endpoint's ans...
Automated Canary build