ByteOtter / OtterDen

A small Flask based blog application. Built for learning purposes only.
GNU General Public License v3.0
2 stars 1 forks source link

[FR]: Add a searchbar where users can search for usernames and tags #95

Open ByteOtter opened 1 year ago

ByteOtter commented 1 year ago

Input field in place on layout.html however issues with it:

Search function in main/utils.py goals:

  1. get search phrase by excluding image:true and user: blocks from search string
  2. match if there is a block called user: or image:true
  3. if is_user_query: return the user aswell as all posts from that user which contan the search string
  4. if only_with_images retrurn only the users posts with images
  5. if topic, filter returned posts by topic
In the end these are the cases and their results: input output
string only all posts which contain matching strings should be returned
user:<username> flag only matching user should be returned
topic:<topic flag only all posts with that topic should be returned
image:true all posts containing images shall be returned
username + string all posts of that user containing that string should be returned
username + topic all posts from that user which have that topic should be returned

etc etc.

ByteOtter commented 1 year ago

WTForms SearchField does not seem to work