X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/b3558ab49ac069f88ee1f1dc39e8127b2519409a..11f3ff4140edcd5dd4d8e20f918c58003c634d10:/floof/controllers/search.py diff --git a/floof/controllers/search.py b/floof/controllers/search.py index 75926e7..5240a0b 100644 --- a/floof/controllers/search.py +++ b/floof/controllers/search.py @@ -21,7 +21,27 @@ class SearchController(BaseController): def results(self): """ Search, implemented the stupid way! """ query = request.params.get('query','') - tags = query.split() + words = query.split() + + tags = [] + for word in words: + components = word.split(':') + if len(components) == 1: + # tags are plain. + tags.append(word) + elif components[0] == "rating": + if components[1].isnumeric(): + score = int(components[1]) + else: + score = Rating.reverse_options.get(components[1]) + + if -1 <= score <= 3: + pass + # TODO: Find stuff that has this rating + # Rating.query.filter(Rating.s) + + + tagtexts = TagText.query.filter(TagText.text.in_(tags)) tagtext_ids = map(lambda x:x.id, tagtexts)