mirror of https://github.com/searxng/searxng.git
Merge pull request #166 from Cqoicebordel/non-exclusif-bang
Add non exclusif bang
This commit is contained in:
commit
b47b8cc2c6
|
@ -38,6 +38,7 @@ class Query(object):
|
||||||
self.query_parts = []
|
self.query_parts = []
|
||||||
self.engines = []
|
self.engines = []
|
||||||
self.languages = []
|
self.languages = []
|
||||||
|
self.specific = False
|
||||||
|
|
||||||
# parse query, if tags are set, which
|
# parse query, if tags are set, which
|
||||||
# change the serch engine or search-language
|
# change the serch engine or search-language
|
||||||
|
@ -83,7 +84,7 @@ class Query(object):
|
||||||
break
|
break
|
||||||
|
|
||||||
# this force a engine or category
|
# this force a engine or category
|
||||||
if query_part[0] == '!':
|
if query_part[0] == '!' or query_part[0] == '?':
|
||||||
prefix = query_part[1:].replace('_', ' ')
|
prefix = query_part[1:].replace('_', ' ')
|
||||||
|
|
||||||
# check if prefix is equal with engine shortcut
|
# check if prefix is equal with engine shortcut
|
||||||
|
@ -110,6 +111,9 @@ class Query(object):
|
||||||
for engine in categories[prefix]
|
for engine in categories[prefix]
|
||||||
if engine not in self.blocked_engines)
|
if engine not in self.blocked_engines)
|
||||||
|
|
||||||
|
if query_part[0] == '!':
|
||||||
|
self.specific = True
|
||||||
|
|
||||||
# append query part to query_part list
|
# append query part to query_part list
|
||||||
self.query_parts.append(query_part)
|
self.query_parts.append(query_part)
|
||||||
|
|
||||||
|
|
|
@ -373,7 +373,7 @@ class Search(object):
|
||||||
|
|
||||||
# if engines are calculated from query,
|
# if engines are calculated from query,
|
||||||
# set categories by using that informations
|
# set categories by using that informations
|
||||||
if self.engines:
|
if self.engines and query_obj.specific:
|
||||||
self.categories = list(set(engine['category']
|
self.categories = list(set(engine['category']
|
||||||
for engine in self.engines))
|
for engine in self.engines))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue