mirror of
https://github.com/searxng/searxng
synced 2024-11-16 21:25:37 +00:00
[fix] autocomplete unicode issue - closes #808
This commit is contained in:
parent
74ed0ad89e
commit
7b1daf254e
@ -81,22 +81,22 @@ def searx_bang(full_query):
|
|||||||
engine_query = full_query.getSearchQuery()[1:]
|
engine_query = full_query.getSearchQuery()[1:]
|
||||||
|
|
||||||
for lc in language_codes:
|
for lc in language_codes:
|
||||||
lang_id, lang_name, country, english_name = map(str.lower, lc)
|
lang_id, lang_name, country, english_name = map(unicode.lower, lc)
|
||||||
|
|
||||||
# check if query starts with language-id
|
# check if query starts with language-id
|
||||||
if lang_id.startswith(engine_query):
|
if lang_id.startswith(engine_query):
|
||||||
if len(engine_query) <= 2:
|
if len(engine_query) <= 2:
|
||||||
results.append(':{lang_id}'.format(lang_id=lang_id.split('-')[0]))
|
results.append(u':{lang_id}'.format(lang_id=lang_id.split('-')[0]))
|
||||||
else:
|
else:
|
||||||
results.append(':{lang_id}'.format(lang_id=lang_id))
|
results.append(u':{lang_id}'.format(lang_id=lang_id))
|
||||||
|
|
||||||
# check if query starts with language name
|
# check if query starts with language name
|
||||||
if lang_name.startswith(engine_query) or english_name.startswith(engine_query):
|
if lang_name.startswith(engine_query) or english_name.startswith(engine_query):
|
||||||
results.append(':{lang_name}'.format(lang_name=lang_name))
|
results.append(u':{lang_name}'.format(lang_name=lang_name))
|
||||||
|
|
||||||
# check if query starts with country
|
# check if query starts with country
|
||||||
if country.startswith(engine_query.replace('_', ' ')):
|
if country.startswith(engine_query.replace('_', ' ')):
|
||||||
results.append(':{country}'.format(country=country.replace(' ', '_')))
|
results.append(u':{country}'.format(country=country.replace(' ', '_')))
|
||||||
|
|
||||||
# remove duplicates
|
# remove duplicates
|
||||||
result_set = set(results)
|
result_set = set(results)
|
||||||
|
Loading…
Reference in New Issue
Block a user