diff options
author | Adam Tauber <asciimoo@gmail.com> | 2016-12-30 18:17:14 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2016-12-30 18:17:14 +0100 |
commit | 6bf9c398a7ed5f3fb624f2ea35a9d00fe016811d (patch) | |
tree | f4e16dd44e38b23d1f879536d80fd2f2f286e583 /searx/engines/bing.py | |
parent | 79ceb13577fcc83eabe642a4ed6dd793b7bf0d4b (diff) | |
download | searxng-6bf9c398a7ed5f3fb624f2ea35a9d00fe016811d.tar.gz searxng-6bf9c398a7ed5f3fb624f2ea35a9d00fe016811d.zip |
[fix] use english as default language in bing
If no language is specified, bing returns results with multiple languages
for one query which isn't really useful. Setting english as default
insted if nothing.
Diffstat (limited to 'searx/engines/bing.py')
-rw-r--r-- | searx/engines/bing.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/searx/engines/bing.py b/searx/engines/bing.py index b2ad7b6cf..15c8ee611 100644 --- a/searx/engines/bing.py +++ b/searx/engines/bing.py @@ -33,8 +33,11 @@ def request(query, params): offset = (params['pageno'] - 1) * 10 + 1 if params['language'] != 'all': - query = u'language:{} {}'.format(params['language'].split('-')[0].upper(), - query.decode('utf-8')).encode('utf-8') + lang = params['language'].split('-')[0].upper() + else: + lang = 'EN' + + query = u'language:{} {}'.format(lang, query.decode('utf-8')).encode('utf-8') search_path = search_string.format( query=urlencode({'q': query}), |