Skip to content

fix: ranking treats text after ". " or " - " in a request title as an optional subtitle - #494

Merged
kikootwo merged 6 commits into
mainfrom
fix/466-subtitle-split
Oct 27, 2026
Merged

kikootwo merged 6 commits into
mainfrom
fix/466-subtitle-split

Conversation

@kikootwo

@kikootwo kikootwo commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #466

What changed

  • Subtitle split (splitSubtitle(), src/lib/utils/match-normalize.ts): in the request title, text after the first :, a dash with spaces on both sides (-, or an en or em dash written the same way) or . is an optional subtitle, the way text after a colon already was. The words before the split stay required. . splits only after a number or a word of four or more letters, so initials (A. J. Fikry) and short abbreviations (Mr. Mercedes, Dr., St., Vol.) don't split, and neither do Prof., Capt., Corp., Dept., Bros. and Hrsg.. A hyphen inside a word (Spider-Man) never splits.
  • Series position (scoreMatch, src/lib/utils/ranking-algorithm.ts): a bare number right before the split ("Die Tribute von Panem 1. Tödliche Spiele") was already not a required number (fix: automatic search stops grabbing the wrong book (stricter title and author matching) #459). It is now also left out of the 80% word-coverage count, but only when the release carries at least half of the subtitle words. A release that leaves out both the number and the subtitle is often another volume named after the series (book 1 of a LitRPG series usually goes by the bare series name), so there the number still counts as missing, as on main: Zogarth - The Primal Hunter [M4B] scores 0 for "The Primal Hunter 3: A LitRPG Adventure", in any split form, with or without the catalog series part. When the release names another position (a G4c conflict), the number counts as missing too. So in both search modes Primal.Hunter.T02… still scores 0 for "Primal Hunter 1. …", and so does the colon form.
  • Different book after the same series or author name (dashNamesOtherSubtitle(), src/lib/utils/match-gates.ts): this applies to a request split at - or . when only its main part is found in the release. A - after that part now counts as the end of the title only when what follows is the request's own subtitle (the G1 rule), an author, or only volume words and numbers. For "Sherlock Holmes - Der Hund der Baskervilles", Arthur Conan Doyle - Sherlock Holmes - Das Zeichen der Vier used to tie the right release at 60 and now scores 40.7 (fuzzy). A request split at a colon keeps the plain - rule. The check covers a release - only: a different book in brackets, after a comma or by, or the series name alone still ties (see Risk).
  • Complete title with brackets: a request split at - or . still tries its full title without brackets before the split, as main did. "Die Tribute von Panem 1. Tödliche Spiele (ungekürzt)" vs Die Tribute von Panem 1. Tödliche Spiele - Suzanne Collins [MP3] stays 60 (it would have dropped to 47).
  • colonSubtitleAgrees shares its agreement check with the new helper. Its behaviour is unchanged.
  • Docs: documentation/phase3/ranking-algorithm.md (Stage 1 optional parts, Stage 2 complete title, Fixed Issues) and documentation/phase3/match-gates.md (G1, G4a).

Why

Only brackets and a colon made a subtitle optional. Audible titles from French and German catalogs often write the subtitle after . or - ("Primal Hunter 1. Une aventure de LitRPG", "C'était ça ou mourir - Prix du Roman FNAC 2026"). The subtitle words were then required, the release names leave them out, and word coverage scored those releases 0 in both search modes.

The apostrophe half of #466 was already fixed on main by the apostrophe fold (foldApostrophes). Those rows score as the same title written without the apostrophe, so this branch doesn't touch apostrophes or audible-series-rank.ts.

Evidence

The six #466 rows (matchScore, French config for the French rows, both search modes):

Request title main (d8011ab) this branch colon form
L'intruse 60 60 n/a
Changer l'eau des fleurs 60 60 n/a
L'Héritage 24.6 24.6 n/a
Ender's Game 60 60 n/a
Primal Hunter 1. Une aventure de LitRPG 0 33.3 33.3
C'était ça ou mourir - Prix du Roman FNAC 2026 0 27.3 27.3

A release with neither the series position nor the subtitle (matchScore, automatic search; interactive is the same):

Request title Release main (64df2b1) without the subtitle check this branch
The Primal Hunter 3: A LitRPG Adventure Zogarth - The Primal Hunter [M4B] 0 47.3 0
The Primal Hunter 3: A LitRPG Adventure The.Primal.Hunter.Zogarth.M4B 0 47.3 0
Defiance of the Fall 3: A LitRPG Adventure JF Brink - Defiance of the Fall [M4B] 0 48.5 0
Beware of Chicken 3: A Xianxia Cultivation Novel Casualfarmer - Beware of Chicken [M4B] 0 43.6 0
The Primal Hunter 3 - A LitRPG Adventure Zogarth - The Primal Hunter [M4B] 0 47.3 0
Primal Hunter 3. Une aventure de LitRPG Primal.Hunter.Zogarth.2024.FR.[MP3] 0 40.4 0
Catch-22. A Novel Joseph Heller - Catch Me [MP3] 0 28.6 0
Apollo 13 - Lost Moon Jim Lovell - Apollo [MP3] 0 33.8 0
  • tests/utils/ranking-subtitle-split.test.ts runs the real rankTorrents():
    • the six rows score above 0 and the same as the colon (or apostrophe-free) form, in both modes;
    • a spaced en dash splits like -;
    • a series name (Der Herr der Ringe. …, Sherlock Holmes - …) or an author name (Terry Pratchett - Mort) before the split, against a release naming another book of that series or author: the requested release ranks first with a higher matchScore, in both modes;
    • another volume (T02, Primal Hunter 2 - Zogarth) scores 0 in both modes;
    • the fix: automatic search stops grabbing the wrong book (stricter title and author matching) #459 rows that leave the position out (Die Tribute von Panem 1. …, Throne of Glass 1 - …) still clear 50;
    • a hyphenated word, an abbreviation, initials and a short word before . score as on main;
    • the eight rows above score 0 in both modes, and with the catalog series part Zogarth - The Primal Hunter 3 [M4B] ranks first above 50 while the bare series name scores 0;
    • "Die Tribute von Panem 1. Tödliche Spiele (ungekürzt)" keeps its complete-title match (60) in both modes.
  • Helper unit tests: splitSubtitle in tests/utils/match-normalize.test.ts, dashNamesOtherSubtitle in tests/utils/match-gates.test.ts.
  • With main's src (d8011ab) and this branch's tests: 28 failed, 219 passed. The 9 ranking behaviour tests fail on an assertion. The 19 helper unit tests fail because the helpers didn't exist yet. The other 25 pass on main by design: the 8 apostrophe-row tests (already fixed there), the 10 wrong-book tests (there the subtitle words are required, so the wrong release already scored 0), the 2 fix: automatic search stops grabbing the wrong book (stricter title and author matching) #459 rows and the 5 unchanged-title pins. The 19 tests added for the wrong-volume rows and the bracketed Panem title pass on main and failed on an assertion before the subtitle check and the bracket-free title (47.3 instead of 0, 47 instead of 60).
  • With the dash guard turned off, 6 of the 10 wrong-book tests fail (the wrong release ties the right one at 60). The other 4 releases are scene names that only reach a fuzzy match.
  • Regression corpora: every row of tests/utils/fixtures/ranking-oracle-223.json and ranking-right-books-223.json was scored on main (64df2b1) and on this branch (562 scores; the right-books rows in both modes). All are identical.

Checks

  • Unit tests for the changed code (vitest related on the three changed src files plus the three test files): PASS, 125 files, 2511 tests
  • Type check and lint: PASS (tsc --noEmit clean; ESLint reports nothing in the six touched files)
  • No image build or E2E run: no change under src/app or src/components
  • Full unit suite: PR Tests (CI)

Risk and rollback

  • Request titles with a spaced dash or a qualifying . change. Titles with brackets only, or no split, score as before. A colon title changes in one case: a bare series position right before the colon, against a release that leaves the number out but carries at least half of the subtitle words, now clears word coverage (on main it scored 0).
  • An optional subtitle only loosens matching. A release that names only the words before the split, plus the author, can now clear word coverage where it scored 0 before. When the release names a different subtitle after -, or another volume, it still loses to the requested book. A scene name that only reaches a fuzzy match can still clear the automatic threshold when the requested release is missing. For "Sherlock Holmes - Der Hund der Baskervilles", Sherlock.Holmes.Eine.Studie.in.Scharlachrot.Arthur.Conan.Doyle.MP3 scores 32 (total 57). The colon form of that title scores it the same on main.
  • Known limit, shared with colon titles: the different-subtitle check reads a release - only. For "Sherlock Holmes - Der Hund der Baskervilles", Sherlock Holmes (Das Zeichen der Vier) - Arthur Conan Doyle, Sherlock Holmes [Das Zeichen der Vier] …, Sherlock Holmes by Arthur Conan Doyle - Das Zeichen der Vier, Sherlock Holmes, Das Zeichen der Vier - … and the series name alone (Arthur Conan Doyle - Sherlock Holmes) score 60 and tie the right release; so do the same shapes for "Der Herr der Ringe. Die Gefährten". They scored 0 on main, and the colon form of both titles scores every one of them 60 on main. Seeders and size then decide.
  • A request split at a colon keeps the plain - rule. On main, "Sherlock Holmes: Der Hund der Baskervilles" ties … - Sherlock Holmes - Das Zeichen der Vier at 60, and this branch leaves that unchanged.
  • Rollback: revert this PR. Nothing stored is rewritten.

Release note

🤖 Generated with Claude Code

kikootwo and others added 6 commits October 27, 2026 06:36
…an optional subtitle (#466)

The request title's subtitle split now also happens at a dash with spaces
on both sides and at ". " after a number or a word of four or more
letters, exactly like the colon. A series position before the split is
left out of the coverage count. For a request split this way, a release
" - " after the main part that names another subtitle no longer counts as
a complete title, so a different book of the same series or author loses
to the requested one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the release names another (#466)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…466)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	documentation/phase3/ranking-algorithm.md
…release carries the subtitle (#466)

A release with neither the position nor the subtitle (often book 1, named
after the series) no longer clears word coverage for book N. A dash or dot
request also tries the full title without brackets again, as main did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ers " - " only (#466)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kikootwo
kikootwo marked this pull request as ready for review October 27, 2026 11:27
@kikootwo
kikootwo merged commit ba411d3 into main Oct 27, 2026
1 check passed
@kikootwo
kikootwo deleted the fix/466-subtitle-split branch October 27, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ranking rejects the right release when the title has an apostrophe or a subtitle after ". " or " - "

1 participant