Allow bang operator anywhere in query
Bang operator can now be placed anywhere in the query, to allow for peak efficiency in stream of consciousness querying (i.e. `big !reddit chungus` will search reddit for big chungus`). Fixes #196main
parent
64567a63ea
commit
ecb7885a56
|
@ -71,8 +71,9 @@ class RoutingUtils:
|
||||||
return self.query
|
return self.query
|
||||||
|
|
||||||
def bang_operator(self, bangs_dict: dict) -> str:
|
def bang_operator(self, bangs_dict: dict) -> str:
|
||||||
|
split_query = self.query.split(' ')
|
||||||
for operator in bangs_dict.keys():
|
for operator in bangs_dict.keys():
|
||||||
if self.query.split(' ')[0] != operator:
|
if operator not in split_query:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return bangs_dict[operator]['url'].format(
|
return bangs_dict[operator]['url'].format(
|
||||||
|
|
Loading…
Reference in New Issue