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 #196
This commit is contained in:
Ben Busby 2021-02-20 15:31:15 -05:00
parent e066a19411
commit 6c85468cd6
No known key found for this signature in database
GPG Key ID: 3B08611DF6E62ED2

View File

@ -71,8 +71,9 @@ class RoutingUtils:
return self.query
def bang_operator(self, bangs_dict: dict) -> str:
split_query = self.query.split(' ')
for operator in bangs_dict.keys():
if self.query.split(' ')[0] != operator:
if operator not in split_query:
continue
return bangs_dict[operator]['url'].format(