fix: fuzzy match ignored short words like 'a' causing false matches

The fuzzy matcher's qw.includes(nw) check matched any artist with
'a' in their name against any query — 'shannon' contains 'a', so
'a silver mt. zion' and 'have a nice life' matched every search.

Added minimum length guards:
- qw.includes(nw): nw must be >= 3 chars (filters 'a', 'an', 'I')
- editDistance: both words must be >= 4 chars (prevents short-word
  false positives like 'mt' matching 'me')
This commit is contained in:
2026-03-30 11:35:41 -04:00
parent a2cb72c0f1
commit 957742aa52
@@ -62,8 +62,8 @@ function fuzzyMatch(query: string, name: string): boolean {
nWords.some(
(nw) =>
nw.includes(qw) ||
qw.includes(nw) ||
(qw.length >= 4 && editDistance(qw, nw) <= FUZZY_MAX_DISTANCE),
(nw.length >= 3 && qw.includes(nw)) ||
(qw.length >= 4 && nw.length >= 4 && editDistance(qw, nw) <= FUZZY_MAX_DISTANCE),
),
);
}