Repository navigation
Stored series key, Health: series spelled several ways, paged Authors/Narrators - #126
Merged
Merged
Conversation
…he per-request spellings read Every series filter (the admin list, the player's /books?series=, /series/books, the series order and the next book) now seeks by key on idx_books_series_key or book_more_series' key index. KeySeries keys older rows once at start (about a second per 50,000 books) and puts stored more_series lists through normalizeMoreSeries first.
… the URL match.SameSeries replaces the catalog's and matchrun's copies (a blank name is no series, a name with no key only itself). Library > Authors/Narrators use the shared SearchBox and Pager with q and page in the URL, like Series.
A book kind whose predicate is two range seeks on idx_books_series_key, which now holds series before series_index and replaces the unused idx_books_series; GET /admin/issues/series-spellings lists the groups with the spelling to offer.
One notice per series, the author merge's bulk edit with a choice of spelling (the Series page's name first) and an Ignore for every book of it; strings in all six locales.
…dropped idx_books_more_series goes with 0041 (nothing reads it now); KeySeries prepares its update and fails the start; Health checks an ignore before the costly predicate; the console's grouped kinds are one list.
series_keys holds the key rules' version and the Unicode versions behind them, so an upgrade that reads a name another way keys the books again. Series and Authors/Narrators share useSearchPage and pageOf; the series-spellings endpoint gets its 400, shape and ignored tests; comments and CLAUDE.md say the new truth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups 1-3 from #123 (series spellings). Docs: KodeStar/audiosilo-docs#127.
1. The series key is stored
Catalog.spellingsread every spelling of a series on each request. The key is now stored, so every series filter is an index seek in any spelling.books.series_key:seriesKey(series),''for none.book_more_series(book_id, library_id, series_key, position): a book's other series, one row per key (PK(book_id, series_key), cascades with the book, index(series_key, library_id, position)).refreshEffectivebesideseries, never computed in SQL.UpsertBookwritesseries, then callsrefreshEffectivein the same transaction, which writes the key./books?series=,/series/books, the series order (seriesOrderKeys), the next book (numberedSeriesMembers) and the rails (SeriesBooks/seriesMembers).TestNextInSeriesPlanasserts the seeks.Catalog.spellings/spellingsOf/distinctNames,seriesNames,sqlList,ftsPhrases,spellSeriesBookFilter.seriesandListOptions.seriesfieldsmemberIDsCatalog.KeySeries): runs at start before the listener, one transaction.more_seriesoverride throughnormalizeMoreSeriesand rebuilds those books, so a list from before Series: one series per spelling, numbers from titles, paged and searchable Series page #123 that names a series twice loses the second entry.server_state.series_keysholds a version (key rules number + Go's Unicode version + x/text's NFKD version). A toolchain or rule change re-keys once instead of leaving filters on stale keys.Two deviations from the plan
(library_id, series_key, series, series_index), not(library_id, series_key, series_index). Withseriesnext to the key, a series' spellings are adjacent, so the Health check below is two range seeks per book. With the planned shape, a 200-book series of one spelling made the Health count quadratic: 2.5 s over 50,000 books, now 86 ms. Filters and the next book use the prefix as planned.idx_books_series(0001) andidx_books_more_series(0039). Nothing reads either any more.Measured: 50,000 books, 2,000 series, 3 spellings each (
TestSeriesKeyScale)The old spellings read cost 9-20 ms per request. Under
-racethe test uses 5,000 books and only logs the times.2. Health: series spelled several ways
series_spellings: another book of its library has the sameseries_keyspelled differently. It shares one predicate between the count, the?issue=list and the newGET /admin/issues/series-spellings, which returns one group per series and library:suggested(seriesName) and each spelling with its books.useMerge, a bulkseriesedit, with Undo).The server never writes files. The rename makes every book say the same in AudioSilo (the players' book details, the Books list, the export), not in other apps that read the tags. The issue brief described it as making the files' tags consistent, so I've said so here.
3. Cleanups
match.SameSeriesreplaces the catalog's and matchrun's copies. A blank name is no series, and a name with no key is only itself. The matchrun copy called""and"!!"one series.SearchBoxandPager, withqandpagein the URL. A new search or library starts on page 1, and Back from the Books list returns to the search. They show 120 per page; "Show N more" is gone.useSearchPage/pageOf, added in the code review.Verified in a real browser
Scratch copy of
audiosilo-server/data(1,168 books; HWFWM as on disk: 8 books "With", 5 "with"), headless Chromium:Gates
scripts/build-admin.sh: 682 tests.go build ./... && go vet ./... && go test -race ./... && golangci-lint run: pass, 0 issues./simplifyand/code-review xhigh --fixran. Applied: the dead index, one series fetch per merge, prepared updates in the backfill, versioned keys, a handler test for the new endpoint, and shared URL paging.Skipped from the review:
SameSeriesisn't memoized; it only runs for books with lists.