Skip to content

fix(search): result filters never ran on auto-pick paths; add title-relevance gate#744

Draft
kevinheneveld wants to merge 1 commit into
Listenarrs:canaryfrom
kevinheneveld:fix/search-filter-wiring-upstream
Draft

fix(search): result filters never ran on auto-pick paths; add title-relevance gate#744
kevinheneveld wants to merge 1 commit into
Listenarrs:canaryfrom
kevinheneveld:fix/search-filter-wiring-upstream

Conversation

@kevinheneveld

Copy link
Copy Markdown
Contributor

The bug

The ISearchResultFilter pipeline (including AudiobookOnlyFilter) only runs inside AsinEnricher's metadata-enrichment path — the automatic sweep and search-and-download apply no result filters at all. Raw indexer results go straight to quality scoring, where a well-seeded music bootleg with a similar name outranks the real audiobook. Field impact (live library): frequent music grabs in place of similarly-named books.

The fix

  • Filter pipeline wired into both auto-pick call sites (AutomaticSearchProcessor, DownloadService.SearchAndDownloadAsync), with a context-aware ApplyFilters(..., audiobook) overload (default-implemented — existing filters unchanged)
  • New RelevanceFilter: ≥30% title+author token overlap against the wanted book (the "Patterson Hood vs James Patterson" defense), with author corroboration required for generic single-word titles
  • Newznab category 3030 restriction on automatic searches (junk filtered at the indexer where honored; RelevanceFilter catches the rest)
  • Supporting: punctuation-tolerant TitleMatcher (Normalize incl. numeral canonicalization — 1stfirst — + Matches) and SignificantTokens. Note: PR feat(library): "Split collection" — break a multi-book record into its real books #722 introduces the same TitleMatcher.cs with identical content — whichever merges second is a trivial resolution.

Tests

17-case relevance suite (overlap thresholds, corroboration, numeral equivalence, music-title rejection); full suite passing.

🤖 Generated with Claude Code

…itle-relevance gate

The SearchResultFilterPipeline (including AudiobookOnlyFilter) only ran
inside AsinEnricher's metadata-enrichment path — the automatic sweep and
SearchAndDownloadAsync applied NO result filters at all, so raw indexer
results went straight to quality scoring, where a well-seeded music
bootleg outranks a real audiobook.

- Apply the pipeline in both auto-pick call sites, with a new
  context-aware ISearchResultFilter overload (default-implemented, so
  existing filters need no edits) and pipeline audiobook parameter.
- New RelevanceFilter: requires >=30% title+author token overlap against
  the wanted audiobook (the "Patterson Hood concert vs James Patterson
  novel" defense), with author corroboration for generic single-word
  titles. Fails open without audiobook context.
- Restrict automatic searches to Newznab category 3030 (Books >
  Audiobook) so music-only indexers can't answer audiobook queries.
- SearchAndDownloadAsync moved to a DownloadService.SearchAndDownload.cs
  partial (architecture size cap).
- Includes TitleMatcher (punctuation-tolerant Normalize with numeral
  canonicalization + Matches) and SignificantTokens; note PR Listenarrs#722 also
  introduces TitleMatcher.cs with identical content - trivial merge
  whichever lands first.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant