fix: search relevance and artist metadata matching#4
Open
reifocS wants to merge 2 commits into
Open
Conversation
The artist metadata endpoint /api/metadata/artist/Mestís returned data for "Mest" (punk rock) instead of "Mestís" (Javier Reyes, progressive). Root cause: MusicBrainz search used limit=1 and blindly took the first fuzzy match. "Mest" ranked higher than "Mestís" in MB's fuzzy scoring. Fix: - Fetch 5 results from MusicBrainz instead of 1 - Pick the best match using _pick_best_mb_artist(): exact normalized match first, then starts-with, then fall back to MB score - Only overwrite the query name with MB name when it's a normalized match (accent/casing differences), not a completely different artist - Guard the TheAudioDB canonical-name fallback with the same check
Searching "mestis" returned garbage like "Steel Meets Steel", "Chopis Centis", "Les Meutes" because: 1. fuzzy_match() used loose substring check (qw in tw) and Levenshtein distance=2 for 6+ char words. "mestis" matched "mystic" (dist=2), "meets" (dist=2), etc. Now: - Substring only matches if query covers 70%+ of the target word - Levenshtein threshold=1 for words under 8 chars - Length difference capped at 1 char 2. Scoring had no artist-name awareness. A tab by artist "Mestís" scored the same as random fuzzy matches. Now: - Exact artist match: +300 - Artist word overlap with query: +200 - Uses accent-stripped comparison for both
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
MusicBrainz artist matching
/api/metadata/artist/Mestísreturned data for "Mest" (punk rock) instead of "Mestís" (progressive)limit=1and blindly took the first fuzzy match_pick_best_mb_artist()get_artist_info()only overwrites the query name when the MB result is a genuine match (accent/casing difference)Search result ranking
fuzzy_match()was too loose: substring check matched partial words, Levenshtein distance=2 matched "mestis" to "mystic"Test plan
/api/metadata/artist/Mestís— returns Mestís data, not Mest/api/metadata/artist/Mest— still returns Mest data correctly