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
main
Ben Busby 2021-02-20 15:31:15 -05:00 committed by Ben Busby
parent 64567a63ea
commit ecb7885a56
1 changed files with 2 additions and 1 deletions

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(