mirror of https://github.com/searxng/searxng.git
Merge 5a1e789ee8
into cd384a8a60
This commit is contained in:
commit
82270e7156
|
@ -155,7 +155,7 @@ class ExternalBangParser(QueryPartParser):
|
||||||
return raw_value.startswith('!!') and len(raw_value) > 2
|
return raw_value.startswith('!!') and len(raw_value) > 2
|
||||||
|
|
||||||
def __call__(self, raw_value):
|
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, [])
|
found, bang_ac_list = self._parse(value) if len(value) > 0 else (False, [])
|
||||||
if self.enable_autocomplete:
|
if self.enable_autocomplete:
|
||||||
self._autocomplete(bang_ac_list)
|
self._autocomplete(bang_ac_list)
|
||||||
|
@ -183,7 +183,7 @@ class BangParser(QueryPartParser):
|
||||||
return raw_value[0] == '!' and (len(raw_value) < 2 or raw_value[1] != '!')
|
return raw_value[0] == '!' and (len(raw_value) < 2 or raw_value[1] != '!')
|
||||||
|
|
||||||
def __call__(self, raw_value):
|
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
|
found = self._parse(value) if len(value) > 0 else False
|
||||||
if found and raw_value[0] == '!':
|
if found and raw_value[0] == '!':
|
||||||
self.raw_text_query.specific = True
|
self.raw_text_query.specific = True
|
||||||
|
@ -224,7 +224,7 @@ class BangParser(QueryPartParser):
|
||||||
|
|
||||||
# check if query starts with category name
|
# check if query starts with category name
|
||||||
for category in categories:
|
for category in categories:
|
||||||
if category.startswith(value):
|
if category.lower().startswith(value):
|
||||||
self._add_autocomplete(first_char + category.replace(' ', '_'))
|
self._add_autocomplete(first_char + category.replace(' ', '_'))
|
||||||
|
|
||||||
# check if query starts with engine name
|
# check if query starts with engine name
|
||||||
|
@ -234,7 +234,7 @@ class BangParser(QueryPartParser):
|
||||||
|
|
||||||
# check if query starts with engine shortcut
|
# check if query starts with engine shortcut
|
||||||
for engine_shortcut in engine_shortcuts:
|
for engine_shortcut in engine_shortcuts:
|
||||||
if engine_shortcut.startswith(value):
|
if engine_shortcut.lower().startswith(value):
|
||||||
self._add_autocomplete(first_char + engine_shortcut)
|
self._add_autocomplete(first_char + engine_shortcut)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue