feat: Configurable minimum-score threshold (+ fix for ranking authors with initials) - #235
Open
NichCodes wants to merge 2 commits into
Open
feat: Configurable minimum-score threshold (+ fix for ranking authors with initials)#235NichCodes wants to merge 2 commits into
NichCodes wants to merge 2 commits into
Conversation
The torrent ranking author-presence gate could not reconcile compacted
initials ("TJ Klune") with spaced initials ("T J Klune"), which zeroed the
entire title/author match score and rejected otherwise-correct, well-seeded
releases. This affected any initials-style author (JD Robb / J D Robb,
George RR Martin / George R R Martin, etc.).
- Add an initials-normalization step (collapseInitials) applied in the
author-presence check and Stage 3 author scoring so spaced and compacted
initials compare equal.
- Lower the accept threshold 50 -> 40 for single high-quality-indexer
setups, guarded by a match-score requirement (matchScore > 0) so the
relaxed bar still cannot admit a wrong book.
Adds regression tests covering the initials variants and a wrong-author
negative case.
…arches Replace the hard-coded auto-search accept threshold with admin-configurable, per-media minimum ranking-score sliders on the Indexers settings tab. - Two optional sliders (Audiobooks, E-books), range 0-100, default 50, styled to match the Indexer Flag Configuration section and marked Optional. - Backed by config keys `indexer.min_quality_score` and `indexer.min_quality_score_ebook`; loaded via the settings GET, validated and persisted (integers 0-100) via the indexer-options route. - search-indexers and search-ebook processors read the configured threshold at runtime (clamped 0-100; missing/invalid -> 50). The title/author match gate (matchScore > 0) is preserved and applied independently, so a value of 0 still rejects wrong books. Manual/interactive searches remain unfiltered. - Default audiobook threshold returns to 50 (was temporarily lowered to 40), now overridable instead of pinned in code. - Extract a single parseMinQualityScore/DEFAULT_MIN_QUALITY_SCORE helper so the four read sites that must stay in lock-step share one implementation. - Update settings, ranking-algorithm, and table-of-contents docs.
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.
Fix torrent ranking for authors with initials; make the minimum-score threshold configurable
Problem
initials ("JRR Tolkien") with spaced initials ("J R R Tolkien"). Because that gate
hard-zeros the entire 60-point title/author match when the author isn't found,
correct, well-seeded releases were scored far below the accept threshold and
rejected — leaving requests stuck in
awaiting_search. It affected anyinitials-style author (JD Robb / J D Robb, George RR Martin / George R R Martin,
W E B Griffin, etc.).
it stricter or more lenient was a code change. Different setups need different
bars (a single high-quality indexer vs. many noisy public ones).
Fix
Add an initials-normalization step (
collapseInitials) that joins runs ofsingle-letter tokens, applied in
checkAuthorPresenceWithParsedand theStage-3 author substring scoring so spaced and compacted initials compare
equal.
Make the accept threshold admin-configurable instead of a hard-coded number.
Two optional sliders on Settings → Indexers (styled like the Indexer Flag
Configuration section, marked Optional):
indexer.min_quality_scoreindexer.min_quality_score_ebookEach ranges 0–100, default 50, with inline help explaining the trade-offs
(too high rejects everything and stalls requests in
awaiting_search; too lowgrabs weaker matches) and a warning when set to 0. The title/author match
gate (
matchScore > 0) still applies independently, so even at 0 a wrongtitle/author is rejected. Manual/interactive searches remain unfiltered.
The search processors read these keys at runtime (clamped 0–100; missing/invalid
→ 50).
For e-books, the same change also adds the title/author match gate
(
matchScore > 0) the audiobook path already had, so a wrong-author release canno longer slip through on size/seeder/format score alone.
The clamp/default logic is centralized in one helper
(
parseMinQualityScore/DEFAULT_MIN_QUALITY_SCORE) shared by all four readsites, since the settings GET, the indexer-options route, and both processors
must interpret the keys identically.
Tests
wrong-author negative to confirm the gate still rejects mismatches.
search-indexers/search-ebookhonor theconfigured threshold (default 50) and the match gate;
indexer-optionspersistsand validates the new keys (integer 0–100); settings save sends them.
Scope
src/lib/utils/ranking-algorithm.ts— initials normalizationsrc/lib/processors/search-indexers.processor.ts,src/lib/processors/search-ebook.processor.ts— read configurable thresholdsrc/lib/utils/min-quality-score.ts— shared parse/clamp helper + defaultsrc/components/admin/MinScoreSlider.tsx— new slider componentsrc/app/admin/settings/tabs/IndexersTab/IndexersTab.tsx,src/app/admin/settings/lib/{types,helpers}.ts— UI + wiringsrc/app/api/admin/settings/route.ts,src/app/api/admin/settings/indexer-options/route.ts— load/save/validatedocumentation/settings-pages.md,documentation/phase3/ranking-algorithm.md,documentation/TABLEOFCONTENTS.md