+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