summaryrefslogtreecommitdiff
path: root/service/app/search_query.py
diff options
context:
space:
mode:
authorBruno Wagner Goncalves <bwagner@thoughtworks.com>2014-08-20 15:43:50 -0300
committerBruno Wagner Goncalves <bwagner@thoughtworks.com>2014-08-20 18:27:01 -0300
commit31289cb156540a95dfe51737d9fd4e1a7393f2f2 (patch)
tree238480ca562c9c65e1aeaaeaebe063549b3718f4 /service/app/search_query.py
parent02df978f9faa4a00b07d2c70d3bd47a25287d0e1 (diff)
Added setup.py and changed app to pixelated because it will be a package
Diffstat (limited to 'service/app/search_query.py')
-rw-r--r--service/app/search_query.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/service/app/search_query.py b/service/app/search_query.py
deleted file mode 100644
index d31129ba..00000000
--- a/service/app/search_query.py
+++ /dev/null
@@ -1,42 +0,0 @@
-from scanner import StringScanner, StringRegexp
-import re
-
-
-def compile(query):
- compiled = {"tags": [], "not_tags": []}
- sanitized_query = re.sub(r"['\"]", "", query.encode('utf8'))
- scanner = StringScanner(sanitized_query)
- first_token = True
- while not scanner.is_eos:
- token = scanner.scan(_next_token())
-
- if not token:
- scanner.skip(_separators())
- continue
-
- if ":" in token:
- compiled = _compile_tag(compiled, token)
- elif first_token:
- compiled["general"] = token
-
- if not first_token:
- first_token = True
-
- return compiled
-
-
-def _next_token():
- return StringRegexp('[^\s]+')
-
-
-def _separators():
- return StringRegexp('[\s&]+')
-
-
-def _compile_tag(compiled, token):
- tag = token.split(":").pop()
- if token[0] == "-":
- compiled["not_tags"].append(tag)
- else:
- compiled["tags"].append(tag)
- return compiled