mirror of https://github.com/searxng/searxng.git
Merge pull request #706 from not-my-profile/remove-broken-quest-op
[fix] remove broken ? search operator
This commit is contained in:
commit
1196abcfce
|
@ -302,7 +302,7 @@ engine is shown. Most of the options have a default value or even are optional.
|
||||||
search engine.
|
search engine.
|
||||||
|
|
||||||
``shortcut`` :
|
``shortcut`` :
|
||||||
Code used to execute bang requests (in this case using ``!bi`` or ``?bi``)
|
Code used to execute bang requests (in this case using ``!bi``)
|
||||||
|
|
||||||
``base_url`` : optional
|
``base_url`` : optional
|
||||||
Part of the URL that should be stable across every request. Can be useful to
|
Part of the URL that should be stable across every request. Can be useful to
|
||||||
|
|
|
@ -14,9 +14,6 @@ Prefix ``!``
|
||||||
Prefix: ``:``
|
Prefix: ``:``
|
||||||
to set language
|
to set language
|
||||||
|
|
||||||
Prefix: ``?``
|
|
||||||
to add engines and categories to the currently selected categories
|
|
||||||
|
|
||||||
Abbrevations of the engines and languages are also accepted. Engine/category
|
Abbrevations of the engines and languages are also accepted. Engine/category
|
||||||
modifiers are chainable and inclusive (e.g. with :search:`!it !ddg !wp qwer
|
modifiers are chainable and inclusive (e.g. with :search:`!it !ddg !wp qwer
|
||||||
<?q=%21it%20%21ddg%20%21wp%20qwer>` search in IT category **and** duckduckgo
|
<?q=%21it%20%21ddg%20%21wp%20qwer>` search in IT category **and** duckduckgo
|
||||||
|
|
|
@ -177,7 +177,7 @@ class ExternalBangParser(QueryPartParser):
|
||||||
class BangParser(QueryPartParser):
|
class BangParser(QueryPartParser):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check(raw_value):
|
def check(raw_value):
|
||||||
return raw_value[0] == '!' or raw_value[0] == '?'
|
return raw_value[0] == '!'
|
||||||
|
|
||||||
def __call__(self, raw_value):
|
def __call__(self, raw_value):
|
||||||
value = raw_value[1:].replace('-', ' ').replace('_', ' ')
|
value = raw_value[1:].replace('-', ' ').replace('_', ' ')
|
||||||
|
|
|
@ -230,13 +230,12 @@ class TestExternalBangParser(SearxTestCase):
|
||||||
class TestBang(SearxTestCase):
|
class TestBang(SearxTestCase):
|
||||||
|
|
||||||
SPECIFIC_BANGS = ['!dummy_engine', '!du', '!general']
|
SPECIFIC_BANGS = ['!dummy_engine', '!du', '!general']
|
||||||
NOT_SPECIFIC_BANGS = ['?dummy_engine', '?du', '?general']
|
|
||||||
THE_QUERY = 'the query'
|
THE_QUERY = 'the query'
|
||||||
|
|
||||||
def test_bang(self):
|
def test_bang(self):
|
||||||
load_engines(TEST_ENGINES)
|
load_engines(TEST_ENGINES)
|
||||||
|
|
||||||
for bang in TestBang.SPECIFIC_BANGS + TestBang.NOT_SPECIFIC_BANGS:
|
for bang in TestBang.SPECIFIC_BANGS:
|
||||||
with self.subTest(msg="Check bang", bang=bang):
|
with self.subTest(msg="Check bang", bang=bang):
|
||||||
query_text = TestBang.THE_QUERY + ' ' + bang
|
query_text = TestBang.THE_QUERY + ' ' + bang
|
||||||
query = RawTextQuery(query_text, [])
|
query = RawTextQuery(query_text, [])
|
||||||
|
@ -252,13 +251,6 @@ class TestBang(SearxTestCase):
|
||||||
query = RawTextQuery(query_text, [])
|
query = RawTextQuery(query_text, [])
|
||||||
self.assertTrue(query.specific)
|
self.assertTrue(query.specific)
|
||||||
|
|
||||||
def test_not_specific(self):
|
|
||||||
for bang in TestBang.NOT_SPECIFIC_BANGS:
|
|
||||||
with self.subTest(msg="Check bang is not specific", bang=bang):
|
|
||||||
query_text = TestBang.THE_QUERY + ' ' + bang
|
|
||||||
query = RawTextQuery(query_text, [])
|
|
||||||
self.assertFalse(query.specific)
|
|
||||||
|
|
||||||
def test_bang_not_found(self):
|
def test_bang_not_found(self):
|
||||||
load_engines(TEST_ENGINES)
|
load_engines(TEST_ENGINES)
|
||||||
query = RawTextQuery('the query !bang_not_found', [])
|
query = RawTextQuery('the query !bang_not_found', [])
|
||||||
|
@ -278,5 +270,5 @@ class TestBang(SearxTestCase):
|
||||||
query = RawTextQuery('the query !', [])
|
query = RawTextQuery('the query !', [])
|
||||||
self.assertEqual(query.autocomplete_list, ['!images', '!wikipedia', '!osm'])
|
self.assertEqual(query.autocomplete_list, ['!images', '!wikipedia', '!osm'])
|
||||||
|
|
||||||
query = RawTextQuery('the query ?', ['osm'])
|
query = RawTextQuery('the query !', ['osm'])
|
||||||
self.assertEqual(query.autocomplete_list, ['?images', '?wikipedia'])
|
self.assertEqual(query.autocomplete_list, ['!images', '!wikipedia'])
|
||||||
|
|
Loading…
Reference in New Issue