diff --git a/__init__.py b/__init__.py index ea08822..37d7912 100644 --- a/__init__.py +++ b/__init__.py @@ -16,7 +16,10 @@ class Code: self.code = code self.name = name self.description = description - self.match = f"{code} {name}" + self.match = f"{code} {name}".casefold() + + def is_match(self, query: str) -> bool: + return query.casefold() in self.match codes = [ Code(100, "Continue", "The client should continue the request."), @@ -84,10 +87,11 @@ codes = [ def build_query_items(query): results = [] for code in codes: - if query.string.casefold() in code.match.casefold(): + if code.is_match(query.string): results.append( + # https://albertlauncher.github.io/reference/classalbert_1_1util_1_1StandardItem.html albert.StandardItem( - id='uuid', + id=str(code.code), text=f"{code.code} {code.name}", subtext=code.description, actions=[]