feat: keep each author of a book and link them separately #96
No reviewers
Labels
No labels
bug
critical
ebook-branch
high
low
main
medium
release-blocker
security
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jfro/fuzzy_catalog!96
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/multiple-authors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #82. Based on main; follows Nye's research notes (keep the byline, add a list, no join table).
Schema:
authorstays the byline (sort, search, matching, CSV and required validation untouched). Newauthors {:array, :string}, default[], not null, GIN index. Migration20261026010000(after #88's) backfills existing rows in batches of 500 with the same pure splitter; tested up, down, up.Changeset: a provider's
authorslist wins; otherwiseauthorsfollows the byline whenever it changes; a list with no byline becomes the byline (", "-joined). Blanks, "Unknown Author" and case-duplicates dropped.Splitter
FuzzyCatalog.Catalog.AuthorNames(pure): splits on,&;and; flipsLast, First(Pratchett, Terry,Herbert, Frank, Anderson, Kevin J.), but notAC/DC, Neil Gaiman; keepsJr.and initials. Known weak spot (as Nye noted):Le Guin, Ursula K.typed in by hand splits in two; provider lists avoid it.BookMatcher.author_names/1(matching) left as is.Providers: Open Library (search), Google Books, Hardcover (search + ISBN; ISBN keeps only contributions nil/"Author", so translators/illustrators drop out) return
authors:. Library of Congress builds one name per<mods:name>as "First Last" (inverted namePart or family+given, dates and trailing punctuation dropped), so its byline is now "Neil Gaiman, Terry Pratchett" instead of "Gaiman, Neil., Pratchett, Terry.".BookLookupfillsauthorsby splitting for any provider that doesn't send one. Lookup results carry the list to Add to Library asbook[authors][].Links: new
<.author_links>on the book page and both library views, one link per author (old rows fall back to splitting the byline).get_books_by_author/1matchesname = ANY(authors)or the byline. Links now use~pencoding only (/author/Neil%20Gaiman, was double-encoded%2520); a name with/works (tested).Tests:
author_names_test.exs,book_authors_test.exs(changeset, list vs byline, edit, author_list fallback, get_books_by_author incl. un-backfilled row, LoC MODS fixture),book_authors_controller_test.exs(book page, library list, author page, AC/DC link round trip, add-from-lookup keeps list).mix precommit: 650 tests pass.Browser check: dev DB backfill split "Terry Pratchett, Neil Gaiman", "Pratchett, Terry", "Brian Herbert & Kevin J. Anderson" correctly; Good Omens page shows two author links and each author page lists it (Terry Pratchett's also lists Mort).
Merging: textually clean against #86–#90 and #94. #89 (refresh metadata): picking a provider's author re-derives the list from the byline via the changeset; carrying the provider list through is a small follow-up after both merge.