on master help sign in
[enh] language selection from query
a641971asciimoo
searx/search.py+6−1
@@ -77,7 +77,12 @@ class Search(object):
77 def parse_query(self):
77 def parse_query(self):
78 query_parts = self.query.split()
78 query_parts = self.query.split()
79 modified = False
79 modified = False
80− if query_parts[0].startswith('!'):
80+ if query_parts[0].startswith(':'):
81+ lang = query_parts[0][1:]
82+ if lang in (x[0] for x in language_codes):
83+ self.lang = lang
84+ modified = True
85+ elif query_parts[0].startswith('!'):
81 prefix = query_parts[0][1:].replace('_', ' ')
86 prefix = query_parts[0][1:].replace('_', ' ')
82 if prefix in engine_shortcuts\
87 if prefix in engine_shortcuts\
83 and not engine_shortcuts[prefix] in self.blocked_engines:
88 and not engine_shortcuts[prefix] in self.blocked_engines: