Repository navigation
fix: automatic search skips releases too small for the book's runtime - #479
Merged
Merged
Conversation
Automatic search only dropped results under 20 MB, so one chapter file of a multi-file Usenet post (57 MB for a 1182-minute book) could clear the 50-point threshold and be imported as the whole book. rankTorrents gets an opt-in minMBPerMinute option: with a known runtime, results under that many MB per minute are dropped next to the 20 MB filter. The automatic search processor sets it to 0.15 (about 21 kbps); interactive search does not, so it still lists everything. No runtime: no change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: H0tChicken <seanwilliams1375@gmail.com>
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.
Replaces #311
What changed
rankTorrents()(src/lib/utils/ranking-algorithm.ts) takes an opt-inminMBPerMinuteoption. When the book's runtime is known, results smaller thanminMBPerMinuteMB per minute of runtime are dropped before scoring, next to the existing 20 MB filter. With no runtime, nothing changes.AUTO_SEARCH_MIN_MB_PER_MINUTE = 0.15(about 21 kbps). Only the automatic search processor (src/lib/processors/search-indexers.processor.ts) passes it. Every automatic path runs through that processor: request create, approve, watched lists, RSS matches, the retry jobs and the admin re-search. Interactive search (requests/[id]/interactive-searchandaudiobooks/search-torrents) does not set it, so it still lists undersized results.Filtered out N results < 20 MBlog line addsor < 0.15 MB/minonly when a runtime is known.documentation/phase3/ranking-algorithm.md(Pre-filters, the interface, a Fixed Reject undersized releases in automatic search #311 line).Why
A Usenet post often splits an audiobook into one file per chapter, and an indexer can list each file as its own result. One such file, 57 MB for a book with a 1182-minute runtime (0.05 MB per minute), names the title and author exactly and gets full availability points as an NZB. Size against runtime is worth only 15 of the 100 base points, so the file still scored well over the 50-point threshold. Automatic search grabbed it and imported a 20-minute fragment as the whole book.
The floor sits at 0.15 MB per minute because complete releases have been seen as low as 0.21 MB per minute (about 29 kbps), and those must still be grabbed, while chapter-file grabs sit near 0.05.
Evidence
tests/utils/ranking-size-floor.test.tsruns the realrankTorrents(): with the floor, the 57 MB file for a 1182-minute book is dropped and a complete release at 0.21 MB per minute is kept; with no runtime, or with the option unset (interactive), both are kept; the 20 MB filter still applies.tests/processors/search-indexers-size-floor.test.tsruns the real processor and ranker with a known runtime: given only the 57 MB file it queues no download and marks the requestawaiting_search; given the file and a full release it grabs the full release and leaves the file out of the fallbacks; with no runtime it still grabs the file. It also checks the log line names the floor only when a runtime is known.tests/api/requests-actions.routes.test.ts,tests/api/audiobooks-search.routes.test.ts) now assert the ranking options carry nominMBPerMinute.main'sranking-algorithm.tsandsearch-indexers.processor.ts(d72326a) and this branch's four test files: 5 failed, 35 passed, all on an assertion (the 57 MB file is ranked and grabbed; the constant does not exist). On this branch: 40/40 pass.ranking-oracle-223,ranking-right-books-223,ranking-non-latin): 405/405 pass, no result changes. The oracle scores without a runtime, and the right-books fixtures sit at 1.0 MB per minute.Checks
vitest relatedonranking-algorithm.tsandsearch-indexers.processor.ts, plus the new and oracle test files): PASS, 84 files, 1723/1723tsc --noEmitclean; ESLint reports nothing new in the 6 touched files compared with main)src/libonlyRisk and rollback
awaiting_searchand interactive search still lists the release.Release note
🤖 Generated with Claude Code