Repository navigation
Author names: display_name vs sort_name, drop ambiguous first/last name - #105
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #105 +/- ##
==========================================
+ Coverage 72.63% 73.07% +0.43%
==========================================
Files 63 63
Lines 3972 3996 +24
Branches 626 633 +7
==========================================
+ Hits 2885 2920 +35
+ Misses 897 891 -6
+ Partials 190 185 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@VikramAditya33 interested to have your feedback on this one ; I tried to simplify stuff, but I might have missed something. |
VikramAditya33
left a comment
Collaborator
There was a problem hiding this comment.
Hey @benoit74, I like the display_name/sort_name idea and couldn't find anything still using the removed fields. A few thoughts from trying it on the PG catalog are inline, none of them blockers. Let me know your thoughts as well.
benoit74
force-pushed
the
benoit74/revisit-author-labels
branch
from
November 2, 2026 16:25
8ad3b8f to
01891dd
Compare
PG author names with more than one comma (e.g. "Andrews, Henry Cranke,
active 1799-1828") had everything after the first comma reversed and
folded into the first name, producing garbled names like "active
1799-1828 Henry Cranke Andrews". The underlying bug was accidental
complexity: first_name/last_name are ambiguous, source-specific
concepts that core (and the UI) had no business dealing with, and
that's exactly what let the scrambling happen in the first place.
- Gutenberg's RDF parser now splits last name / first name / a
free-text suffix properly (no more reversing), and renders a
recognized title before the name ("Sir Thomas Browne") or a
generational suffix after it ("Horatio Alger Jr.") instead of always
parenthesizing; anything else (dates, "Saint", other titles, role
annotations, ...) still defaults to parentheses. Verified against
the real PG catalog (40,774 unique author strings).
- Core only deals with two name concepts now: `Creator.display_name`
(the formatted string shown to readers, e.g. "Henry Cranke Andrews
(active 1799-1828)") and `Creator.sort_name` (the last name alone,
used only to sort, never displayed). Dropped the now-unused
first_name/last_name fields and the JSON/UI's ambiguous `name` field
is now `displayName`, matching the Python side.
- Fixed two UI spots that were sorting authors by the display string
instead of the sort key (same class of bug the author list already
had fixed): the home page's no-popularity author fallback, and the
book list's "sort by author" option.
- Stopped mentioning the author twice in a book's full-text search
index entry when it has no description.
Fixes #64
benoit74
force-pushed
the
benoit74/revisit-author-labels
branch
from
November 2, 2026 16:30
01891dd to
1289a2b
Compare
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.
Summary
The Gutenberg bug (#64) was a symptom of a deeper issue:
first_name/last_nameare ambiguous, source-specific concepts (not every source has them, and "last name" doesn't mean the same thing everywhere), and core's machinery had no business dealing with them. That's accidental complexity that isn't actually useful to the UI, and it's exactly what let the suffix-scrambling bug happen in the first place.Core (and the UI) only ever need two things about an author's name:
display_name: a nicely formatted string to show readers, e.g.Henry Cranke Andrews (active 1799-1828).sort_name: an opaque, technical key for unambiguous sorting (last name, then first name, then any disambiguating text a source provides), e.g.Andrews, Henry Cranke, active 1799-1828. Never displayed.Changes:
Creator.name→display_name;Creator.sort_nameis now that composite sort key instead of just a last name, so two authors sharing a last name (e.g. Alice Clarke / Bob Clarke) sort correctly instead of comparing equal.Creator.first_name/last_nameentirely. Gutenberg and OpenTextbooks still parse first/last locally just long enough to builddisplay_nameandsort_name, then discard them; nothing downstream needs the decomposed form.AuthorPreview.name→display_name(displayNamein JSON), matching the Python side, and updated every UI consumer."active 1799-1828") into the first name; keep them as a disambiguating suffix shown in parentheses.Fixes #64