From 5a1e789ee8ed54d68ca7bd1d902623f7ab9bc1c9 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Tue, 24 May 2022 23:41:31 +0200 Subject: [PATCH] Feature: bang & external bang can be written in upper case Close #1223 --- searx/query.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/searx/query.py b/searx/query.py index b8e1c1275..8a85e1d6d 100644 --- a/searx/query.py +++ b/searx/query.py @@ -153,7 +153,7 @@ class ExternalBangParser(QueryPartParser): return raw_value.startswith('!!') def __call__(self, raw_value): - value = raw_value[2:] + value = raw_value[2:].lower() found, bang_ac_list = self._parse(value) if len(value) > 0 else (False, []) if self.enable_autocomplete: self._autocomplete(bang_ac_list) @@ -180,7 +180,7 @@ class BangParser(QueryPartParser): return raw_value[0] == '!' def __call__(self, raw_value): - value = raw_value[1:].replace('-', ' ').replace('_', ' ') + value = raw_value[1:].replace('-', ' ').replace('_', ' ').lower() found = self._parse(value) if len(value) > 0 else False if found and raw_value[0] == '!': self.raw_text_query.specific = True @@ -221,7 +221,7 @@ class BangParser(QueryPartParser): # check if query starts with category name for category in categories: - if category.startswith(value): + if category.lower().startswith(value): self._add_autocomplete(first_char + category.replace(' ', '_')) # check if query starts with engine name @@ -231,7 +231,7 @@ class BangParser(QueryPartParser): # check if query starts with engine shortcut for engine_shortcut in engine_shortcuts: - if engine_shortcut.startswith(value): + if engine_shortcut.lower().startswith(value): self._add_autocomplete(first_char + engine_shortcut)