feat: fuzzy search for songs and lyrics #140

Merged
joshuafhiggins merged 1 commits from t3/fuzzy-song-lyrics-search-1 into main 2026-11-20 02:17:10 -05:00
Owner

Searching "let your people go" returned nothing, while "I will never let your people go" found The Plagues. searchLibrary kept only the top 50 search index hits and then dropped those without a matching line. Common words pushed the song past 50. Typos also found nothing.

Fix

  • Lyrics search checks the index's whole page (up to 1024) line by line, then sorts and trims to 50.
  • New client/fuzzy-search.ts: words ignore accents and apostrophes ("beyonce" finds "Beyoncé", "dont" finds "Don't"). Typos allowed: none under 4 letters, 1 for 4 to 7, 2 for longer. The last word may be a prefix.
  • Lyrics lines rank: exact phrase, then every word in any order, then with typos.
  • Title, artist and album search gain a 30 (every word) and 20 (with typos) tier below the existing scores.
  • In-list song filters on web and mobile use the same matcher.

Trade-off: library search now reads up to 1024 lyrics docs per query instead of 50, the same as matchingSongIds already did. A query where every word is misspelled still finds nothing, since the search index has no typo tolerance.


Made by Claude Opus 5.5 (claude-opus-5-5) in Claude Code.

🤖 Generated with Claude Code

Searching "let your people go" returned nothing, while "I will never let your people go" found The Plagues. `searchLibrary` kept only the top 50 search index hits and then dropped those without a matching line. Common words pushed the song past 50. Typos also found nothing. ## Fix - Lyrics search checks the index's whole page (up to 1024) line by line, then sorts and trims to 50. - New `client/fuzzy-search.ts`: words ignore accents and apostrophes ("beyonce" finds "Beyoncé", "dont" finds "Don't"). Typos allowed: none under 4 letters, 1 for 4 to 7, 2 for longer. The last word may be a prefix. - Lyrics lines rank: exact phrase, then every word in any order, then with typos. - Title, artist and album search gain a 30 (every word) and 20 (with typos) tier below the existing scores. - In-list song filters on web and mobile use the same matcher. Trade-off: library search now reads up to 1024 lyrics docs per query instead of 50, the same as `matchingSongIds` already did. A query where every word is misspelled still finds nothing, since the search index has no typo tolerance. --- Made by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
joshuafhiggins added 1 commit 2026-11-20 02:16:49 -05:00
Lyrics search kept only the top 50 search index hits before checking
lines, so phrases of common words like "let your people go" lost the
song. Check the whole index page instead, and match titles, artists,
albums and lyrics with typo tolerance, ignoring accents and apostrophes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joshuafhiggins force-pushed t3/fuzzy-song-lyrics-search-1 from cd983f2c7d to 19894805df 2026-11-20 02:16:49 -05:00 Compare
joshuafhiggins merged commit 6e2794df66 into main 2026-11-20 02:17:10 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joshuafhiggins/otunes#140