X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/366dedf71b3cdd775251c7cea4b1519b44b37164..db4c5f0b56d22815ecc31754271797b2401c9458:/floof/lib/search.py?ds=sidebyside diff --git a/floof/lib/search.py b/floof/lib/search.py deleted file mode 100644 index f7ce65b..0000000 --- a/floof/lib/search.py +++ /dev/null @@ -1,43 +0,0 @@ -from floof.model.art import Art, Tag, TagText - -def do_search(query): - tags = query.split() - - tagtexts = TagText.query.filter(TagText.text.in_(tags)) - tagtext_ids = [_.id for _ in tagtexts] - - # Fetch art that has all the tags - artwork = Art.query.join(Tag) \ - .filter(Tag.tagtext_id.in_(tagtext_ids)) \ - .all() - return artwork - - - - - - -# unfinished stuff -def parse(query): - 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) -