From 957742aa529c6010a0044d792f75dbc25813c26f Mon Sep 17 00:00:00 2001 From: Caleb Allen Date: Mon, 30 Mar 2026 11:35:41 -0400 Subject: [PATCH] fix: fuzzy match ignored short words like 'a' causing false matches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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') --- frontend/src/components/explore-view/explore-view.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/explore-view/explore-view.ts b/frontend/src/components/explore-view/explore-view.ts index 5d800a0..e2cba94 100644 --- a/frontend/src/components/explore-view/explore-view.ts +++ b/frontend/src/components/explore-view/explore-view.ts @@ -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), ), ); }