fix: skip fuzzy matching for short banned terms (<=3 chars) to prevent false positives

This commit is contained in:
Jarian Cottingham 2026-07-02 18:39:29 +00:00
parent 415fe2324b
commit 204b7fab81

View File

@ -71,6 +71,9 @@ def _is_banned(query: str) -> bool:
if len(word) <= 3: if len(word) <= 3:
continue continue
for term in _banned_terms: for term in _banned_terms:
# Skip fuzzy matching for very short banned terms (too many false positives)
if len(term) <= 3:
continue
# Only fuzzy match for terms with similar length # Only fuzzy match for terms with similar length
if abs(len(word) - len(term)) > 2: if abs(len(word) - len(term)) > 2:
continue continue