Skip to content

fix: CamelCase author names fail automatic search matching#219

Open
rinseaid wants to merge 1 commit into
kikootwo:mainfrom
rinseaid:fix/camelcase-author-matching
Open

fix: CamelCase author names fail automatic search matching#219
rinseaid wants to merge 1 commit into
kikootwo:mainfrom
rinseaid:fix/camelcase-author-matching

Conversation

@rinseaid

@rinseaid rinseaid commented Jun 4, 2026

Copy link
Copy Markdown

Summary

  • Authors with CamelCase prefixes (Mc, Mac) silently fail automatic search
  • scoreMatch() calls .toLowerCase() before parsing authors, destroying the casing that normalizeForMatching() relies on to split prefixes like "McGowan" → "Mc Gowan"
  • The CamelCase split regex /([a-z])([A-Z])/g never matches on already-lowercased input, so "mcgowan" stays unsplit and fails the author presence check
  • Automatic mode sets requireAuthor: true, so these results get matchScore: 0 and fall below the 50-point threshold
  • Interactive search is unaffected because it uses requireAuthor: false
  • Affected names include McGowan, McFadden, McAllister, McGinnis, and any Mc/Mac prefix author

Files Changed

File Change
src/lib/utils/ranking-algorithm.ts Remove premature .toLowerCase() before author parsing so CamelCase survives into normalizeForMatching(). Add /i flag to split regex, move lowercase into filter comparison.
tests/utils/ranking-algorithm.test.ts Add test cases for CamelCase author name matching (McGowan, McFadden)

Testing

  • All existing tests pass (vitest run)
  • Existing McFadden test (expects matchScore < 45 for title mismatch) still passes at 37.5
  • New tests verify McGowan and McFadden score ≥ 50 when title and author both match
  • Verified against live Prowlarr results: McGowan "The Housekeeper" scores 78 with fix vs 0 without

AI Disclosure

Found the bug manually by tracing why automatic searches kept returning 0 grabs for Mc-prefix authors. Used Claude to help develop and validate the fix. All changes reviewed and tested against a live instance.

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