logo

searx

My custom branche(s) on searx, a meta-search engine
commit: a641971a6f1be82e16c7e969c91148cc1c83c31b
parent: 7f45e8a562ea6a57ab9126b99cba87b9a40bfaa7
Author: asciimoo <asciimoo@gmail.com>
Date:   Sun,  9 Feb 2014 01:22:30 +0100

[enh] language selection from query

Diffstat:

Msearx/search.py7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/searx/search.py b/searx/search.py @@ -77,7 +77,12 @@ class Search(object): def parse_query(self): query_parts = self.query.split() modified = False - if query_parts[0].startswith('!'): + if query_parts[0].startswith(':'): + lang = query_parts[0][1:] + if lang in (x[0] for x in language_codes): + self.lang = lang + modified = True + elif query_parts[0].startswith('!'): prefix = query_parts[0][1:].replace('_', ' ') if prefix in engine_shortcuts\ and not engine_shortcuts[prefix] in self.blocked_engines: