Repository navigation
fix: automatic search stops grabbing the wrong book (stricter title and author matching) - #459
Merged
Merged
Conversation
…title words Automatic search now rejects a release when a one-word title does not stand alone, a number in the required title is missing, the author only appears inside other words, or the release names a different series position right after the title. A colon subtitle that agrees with the request, and author initials, now earn full credit. Interactive search keeps listing every result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…after the series name - G4b now only requires the title word to start a name element: first, after an author form G3 accepts, or after a separator. Nothing after the word is read, and the check also covers a Stage 2 complete title the word only ends (Children of Dune for "Dune"). The complete-title 45 from G4b is gone. - An unspaced -, . or _ separates only when the name also uses another delimiter. - G4c reads a bare number after the series name before the requested position and after a request subtitle word, so Divergent Trilogy 2 no longer ties Divergent (Divergent Trilogy, Book 1). Ranges (Book 1-7) are box sets. - G1 ignores volume words and rejects a subtitle naming another number. - G4a treats a bare number before a ". ", " - " or ":" split as the series position. bk joins the shared volume word list. - Adds the right-book corpus test: 193 names that clear 50 on main, 5 listed exceptions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d unit words are not volumes - G4b: a number or volume token right before the word counts as a left boundary (`Stormlight Archive 3 Oathbringer`, `Discworld.04.Mort`). `Book 1 It Grows on You` moves to the let-through table at main's score. - G4c: positions leave out `v`, so a glued `v2` is not read as volume 2. - G4c: `hours`, `discs`, `parts`, `tracks`, `books` count as unit words after a bare number. - Tests: four must-pass rows, the Silo 1 Wool race, and three rows pinned to main's score (`v2`, `29 Hours`, `2 Discs`). Docs updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kikootwo
marked this pull request as ready for review
October 27, 2026 06:13
This was referenced Oct 27, 2026
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.
Closes #223
Related: #330 (series position from Audible; stays open)
What changed
Automatic search (audiobooks and ebooks,
requireAuthor: true) gets four new reject gates and two scoring fixes inscoreMatch. The 50/50 threshold, size scoring (#318 baseline), format, seeders and bonuses are unchanged.It,DuneorThe Martian, at least one occurrence of the word in the release must be the first word, follow the author, follow a number or volume token (Stormlight Archive 3 Oathbringer,Discworld.04.Mort), or follow a separator. The author counts in any form the author check accepts: full name, glued (leechild), surname alone or surname first (Le Guin,Herbert Frank), collapsed initials (JRR Tolkien), with a possessive. Separators are:,],),}, a dash with spaces,.and_-_; an unspaced-,.or_counts only when the name also uses another word delimiter, soStephen-King-You-Like-It-DarkerandIsaac.Asimov.Second.Foundationfail whileAndy_Weir-The_Martianpasses. Stop words the request itself has before the word are skipped (thefor "The Martian"); others are not, soThe Getaway Carfails for "Getaway". Nothing after the word is read. The check also applies when the title score already found a complete match, soChildren of Dune,Second FoundationandThe Fall of Hyperionno longer match "Dune", "Foundation" and "Hyperion". A release that passes is scored as before. Titles with a digit (1Q84) and CJK or Thai titles are exempt.01as1, the English words one to twenty as digits, andt01,tome2,vol3,book4,bk5as their number. Extra numbers in the release (years, bitrates) never count against it. A bare number right before a.,-or:subtitle split is the series position, not a required number:Die Tribute von Panem - Tödliche Spielematches "Die Tribute von Panem 1. Tödliche Spiele".Andy Weirno longer matches "Weird Candy", andLee Childno longer matches "Children". A possessive or plural (Robert Ludlum's,Tom.Clancys), digits touching the name (King2017) and the name glued together (leechild) still match. CJK and Thai names keep substring matching.(book 1),#12, or a split number as above) and the release names only other positions, the release is rejected. Explicit markers (T03,Book 2,#11) are read right after the title or series name. Bare numbers are read right after the series name that comes before the requested position, and after a word of the request's subtitle, soDivergent Trilogy 2 - Insurgent,Twilight Saga 2andWool Silo 3no longer tie or beat book 1. A number followed by a unit (64 kbps,2 CD,29 Hours,2 Discs) and 4-digit years are not read, and a gluedv2(often a re-release tag) is not a volume. A range is a box set:Harry Potter Book 1-7passes for Book 2.Discworld 08 - City Watch Book 1 - Guards! Guards!still matches "Guards! Guards! (Discworld, Book 8)". This is the title-only part of Automatic search can grab the wrong book in a series #330.Deep Down: A Reacher Storyis a complete match for "Deep Down (A Jack Reacher short story)". Volume words and numbers do not count as agreement, and a subtitle with a number the request lacks never agrees, soMistborn: Mistborn 2andDune: Book Twoget no complete-title credit for a Book 1 request.JD Robbfor "J D Robb" now gets the full 15, not partial fuzzy credit.src/lib/utils/match-gates.ts(303 lines).ranking-algorithm.tsgets shorter (1244 to 1201 lines).documentation/phase3/match-gates.md;documentation/phase3/ranking-algorithm.mdandTABLEOFCONTENTS.mdpoint to it.Interactive search still lists every result: no gate rejects there. Scores and order do change through the colon-subtitle rule, initials credit, whole-word author credit and number folding (
Ernest Cline - Ready Player 1for "Ready Player One" 0 to 41.1;Naked in Death by JD Robb50 to 60).Why
#223 asked for a configurable threshold. A report in #223 showed that runtime lookups worked and the failures came from the title and author match, in two kinds: right books scoring under 50 (a colon subtitle, initials), and wrong books scoring over 50 for short titles (
ItgrabbedYou Like It Darker,Getawaygrabbed a MatchUp anthology), because a full author match plus format, size and seeders carried them past the bar. A second report in #223 added two wrong-volume grabs from a French library. A lower threshold would grab more wrong books, so this fixes the matching and keeps the threshold.Scores (matchScore / total, automatic mode)
You Like It Darker by Stephen King [ENG / M4B]It Grows on You by Stephen King [ENG / M4B]The Getaway Car - MatchUp by Lee Child [ENG / M4B](constructed)Tom Clancy's Op-Center 11 - Call to Treason [ENG / M4B](constructed)Tom Clancy's Op-Center #11: Call to Treason by Tom Clancy [ENG / M4B](constructed)Le.Probleme.a.Trois.Corps.T2.La.Foret.Sombre.Liu.Cixin.VFF.[M4B.128kbs]-NOTAGMatt Dinniman - Dungeon Crawler Carl, T03 Le Livre de recettes…Weird Candy Hail by Rando [M4B](constructed)Children of the Fleet by Orson Scott Card [M4B](constructed)Stephen-King-You-Like-It-Darker-ENG-M4B(constructed)Frank Herbert - Children of Dune [M4B](constructed)Veronica Roth - Divergent Trilogy 2 - Insurgent [M4B](constructed)Stephen King - It (Unabridged) [M4B]It by Stephen King [ENG / M4B]Andy.Weir.The.Martian.Unabridged.M4Bleechild-getaway-mp3Deep Down: A Reacher Story by Lee Child [ENG / MP3]Naked in Death by JD Robb [ENG / M4B]Primal.Hunter.01.Zogarth.2024.FR.[MP3.128.KBPS]-NOTAGTom Clancy - Op-Center 12 - War of Eagles [M4B]Matt Dinniman - Dungeon Crawler Carl, T01 - 2024 [M4B] - SGFxTerry Pratchett - Discworld 08 - City Watch Book 1 - Guards! Guards! [MP3]J.K. Rowling - Harry Potter Book 1-7 - Philosophers Stone, Chamber of Secrets, Prisoner of AzkabanSuzanne Collins - Die Tribute von Panem - Tödliche Spiele (ungekürzt) [MP3](de)Andy Weir - Artemis (Unabridged) [MP3 64kbps]Runtimes (min): It 2683, Getaway 90, Deep Down 60, Op-Center 720, Le problème 900, Dungeon Crawler Carl 800, Hail and The Fleet 800, Naked in Death 600, Primal Hunter 1500, Artemis 540, others 600. "NZB" means no seeders field, which earns the full 15.
Races (two or three results in one search, what automatic search downloads): the right book now wins in every case tested.
Veronica.Roth.Divergent.Unabridged.M4B(8 seeders) beatsDivergent Trilogy 2 - Insurgent(40 seeders),Frank.Herbert.Dune.64kbps.MP3beatsChildren of DuneandGod Emperor of Dune, andIsaac.Asimov.Foundation.Unabridged.MP3beatsSecond Foundation;maindownloads the wrong book in all three.Evidence
Unit tests
tests/utils/ranking-right-books-223.test.tswithfixtures/ranking-right-books-223.json: 193 right-book release names (one-word titles in scene, dotted, dashed and bracket shapes, ebooks, de/fr/es/it, Cyrillic, Greek, Korean, CJK, series and box sets, initials and co-authors) that clear 50 onmain. All clear 50 here except 5 listed exceptions (see Risk).tests/utils/ranking-match-gates.test.tsruns every case throughrankTorrents/rankEbookTorrents: 42 wrong books (match 0, total under 50), including the sequel, dash-only and title-ending rows; 13 releases the one-word check lets through, pinned to theirmainscore; 74 right books that must clear 50 on bothmainand this branch (a series number right before a one-word title included), plus 7 ebook rows and one interactive-mode row; 10 races where the right book must be the one downloaded; 3 rows the volume check must not read as a position (v2,29 Hours,2 Discs), pinned to theirmainscore; and 8 rows for right books that scored low onmainand colon subtitles that must not gain the complete-title score.tests/utils/ranking-oracle-223.test.tsreplays all 176 (release, request, mode, language) pairs the existing ranking suites score, against the matchScore each had before this change. All are unchanged except 7 initials rows, which rise (Olive Juice by T J Klune51 to 60,Olive Juice Book 1 T J Klune33.7 to 42,A Game of Thrones by George RR Martin54.3 to 60, and four more to 60).tests/processors/search-indexers-non-latin.test.ts: a request for "It" whose only result isYou Like It Darker(NZB) goes back toawaiting_searchand queues no download.ranking-algorithm.tsfrommainin place, 54 of the new tests fail, all on an assertion: 40 wrong-book rows, 4 races, 4 low-scoring right books, the 5 listed exceptions (which pass onmain) and the processor test. The 2 number-word wrong-book rows (One,Twelve), every must-pass row and every corpus row pass on both.Checks
vitest relatedforranking-algorithm.tsandmatch-gates.ts: PASS, 78 files, 1691/1691ranking-algorithm,ranking-non-latin,ranking-match-gates,ranking-oracle-223,ranking-right-books-223,match-gates,match-normalize,search-indexers-non-latin): PASS, 808/808; the new wrong-book rows fail before the fixtsc --noEmitclean; ESLint finds nothing new in the changed files: 1 warning, already onmain, which has 2 in the same files)Risk and rollback
Automatic search only. Right books that can now be rejected, so a request waits for a better release. In the 193-row right-book corpus, 5 fail; each falls under one of these classes, which also cover shapes outside the corpus:
The Chronicles of Narnia Book 1 - The Magician's Nephewfor Book 6,The Witcher Book 1 - Blood of Elvesfor Book 3), and a sub-series number right after the title (Guards! Guards! - Book 1 of the City Watchfor "(Discworld, Book 8)"). A bare number after the series name meets the same numbering problem:C.S. Lewis - Chronicles of Narnia 1 - The Lion, the Witch and the Wardrobefails for "The Lion, the Witch and the Wardrobe (The Chronicles of Narnia, Book 2)". Half of a split book (The Way of Kings Vol 2for "(Book 1)") also fails.Frank Herbert Collection Dune,Audiobook Dune by Frank Herbert,Sebastian Fitzek - Thriller Das Paket).Ken FollettvsKenneth Follett), and declined forms fail the gate (Стивена Кинга).He Who Fights with Monsters Ifor "… 1"), a number spelled out above twenty, or a release that leaves out a required number (Tom Clancy's Op-Center - War of Eaglesfor "Fix request button disable logic for status states #12") fails. A box set named by its book count (Divergent 4 Book Collectionfor "Divergent (Book 1)") is read as volume 4 and fails.Still let through, scored as on
main(the one-word check reads only the left side):It Grows on You(F2),It Ends With UsandIt Ends Herefor "It";Dune Messiahfor "Dune";Mistborn Secret History;The Martian Chronicles. AlsoChapterhouse: Dune, after its colon.Uglies Series 2 - Prettiesfor "Uglies (Uglies, Book 1)",Skyward Flight 2), a number word after a volume word (Dune: Book Two), and numbered sequels of a title with no position in the request (Frank Herbert - Dune 2).Le.Probleme.a.Trois.Corps.2.La.Foret.Sombre…,Dungeon Crawler Carl 03 - …,Dungeon Crawler Carl Book Three). Automatic search can grab the wrong book in a series #330 covers these.Tom Clancy's Op-Center 01-12) still passes.12:without#, a sibling that leaves the number out passes (Tom Clancy's Op-Center: Out of the Ashesfor "Tom Clancy's Op-Center 12: War of Eagles",He Who Fights with Monsters IIfor "He Who Fights with Monsters 1: A LitRPG Adventure").War of Eagles by Jeff Rovinfor "Tom Clancy's Op-Center Fix request button disable logic for status states #12: War of Eagles" stays rejected: Audible credits only Tom Clancy. Interactive search finds it.L'intrusevsL.Intruse) and request subtitle words after.or-are not handled here.Of 83 wrong-book release names probed,
maingrabs 80 and this PR 33 (all 33 scored as onmain).Rollback: revert this PR. Nothing is stored; no data needs undoing.
Release note
🤖 Generated with Claude Code