diff options
author | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2015-01-03 02:31:23 +0100 |
---|---|---|
committer | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2015-01-03 02:31:23 +0100 |
commit | 96c4d52eef7de13f6fa1d6e0ae651c50c3bba515 (patch) | |
tree | e85fea57da855c1a558559e1124f163837fb5da8 /searx/query.py | |
parent | 7b531c6fcefe1c0c5cc19967454cdddb6e1c8fbd (diff) | |
download | searxng-96c4d52eef7de13f6fa1d6e0ae651c50c3bba515.tar.gz searxng-96c4d52eef7de13f6fa1d6e0ae651c50c3bba515.zip |
Add non exclusif bang
Allow to perform a search while adding an engine (or a category) without adding it "officially" to the request.
'?' is used to add an engine without modifying anything else to the request. For example, you can perform a search in the 'general' category, and if you add '?tw' the result from Twitter will be added to the originals results.
Diffstat (limited to 'searx/query.py')
-rw-r--r-- | searx/query.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searx/query.py b/searx/query.py index 9f711e982..a10a886ff 100644 --- a/searx/query.py +++ b/searx/query.py @@ -38,6 +38,7 @@ class Query(object): self.query_parts = [] self.engines = [] self.languages = [] + self.specific = False # parse query, if tags are set, which # change the serch engine or search-language @@ -83,7 +84,7 @@ class Query(object): break # this force a engine or category - if query_part[0] == '!': + if query_part[0] == '!' or query_part[0] == '?': prefix = query_part[1:].replace('_', ' ') # check if prefix is equal with engine shortcut @@ -110,6 +111,9 @@ class Query(object): for engine in categories[prefix] if engine not in self.blocked_engines) + if query_part[0] == '!': + self.specific = True + # append query part to query_part list self.query_parts.append(query_part) |