From ecb7885a561dc323f919134bed86ee0f7a5100c1 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Sat, 20 Feb 2021 15:31:15 -0500 Subject: [PATCH] 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 --- app/utils/routing_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/utils/routing_utils.py b/app/utils/routing_utils.py index 55a6253..4cbbb16 100644 --- a/app/utils/routing_utils.py +++ b/app/utils/routing_utils.py @@ -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(