From f3634f9dbcb6c7cc6952f7d9e40879518c4e6eb1 Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Mon, 6 Sep 2021 01:40:49 +0200 Subject: Return 0 if search string has no a-z characters --- bot/exts/info/tags.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bot/exts/info/tags.py b/bot/exts/info/tags.py index 0fc6e99d0..3d222933a 100644 --- a/bot/exts/info/tags.py +++ b/bot/exts/info/tags.py @@ -109,6 +109,9 @@ class Tag: def _fuzzy_search(search: str, target: str) -> float: """A simple scoring algorithm based on how many letters are found / total, with order in mind.""" _search = REGEX_NON_ALPHABET.sub("", search.lower()) + if not _search: + return 0 + _targets = iter(REGEX_NON_ALPHABET.split(target.lower())) current = 0 -- cgit v1.2.3