From db3c15ea0dd1aa54e85af72679d6d0694e4bbbbc Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Thu, 4 Jul 2024 11:31:38 -0400 Subject: [PATCH] hide snippets pass room list in search page modified: app.py modified: templates/base.html modified: templates/search.html --- app.py | 5 +++++ templates/base.html | 2 +- templates/search.html | 9 ++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 8061551..81fe43d 100644 --- a/app.py +++ b/app.py @@ -141,11 +141,15 @@ def chat(room_name): @app.route("/search") def search_page(): + # Query all rooms so that newest is first. + rooms = Room.query.order_by(Room.id.desc()).all() + keywords = request.args.get("keywords", "") username = request.args.get("username", "guest") if not keywords: return render_template( "search.html", + rooms=rooms, keywords=keywords, results=[], username=username, @@ -157,6 +161,7 @@ def search_page(): return render_template( "search.html", + rooms=rooms, keywords=keywords, results=search_results, username=username, diff --git a/templates/base.html b/templates/base.html index abf89ed..34c3423 100644 --- a/templates/base.html +++ b/templates/base.html @@ -171,7 +171,7 @@
- +
diff --git a/templates/search.html b/templates/search.html index d58c7ac..e86c76a 100644 --- a/templates/search.html +++ b/templates/search.html @@ -6,13 +6,15 @@ @@ -23,8 +25,9 @@ {% for result in results %}
- {{ result.room_name }} ({{ result.room_title or "No title" }})
- Snippets: {{ result.snippets | join(' ... ') }}
+ {{ result.room_name }}
+ {{ result.room_title or "No title" }}
+ Score: {{ result.score }}