From a7e66854de844eb6eb663e07d65f0b140ab8f149 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 15 Feb 2022 13:39:39 -0800 Subject: web: tweak 'generic' / container mix-in search result behavior --- python/fatcat_web/routes.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index c1b5f929..f8182679 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -1086,8 +1086,17 @@ def release_search() -> AnyResponse: if "q" not in request.args.keys(): return render_template("release_search.html", query=ReleaseQuery(), found=None) + # if this is a "generic" query (eg, from front page or top-of page bar), + # and the query is not all filters/paramters (aka, there is an actual + # term/phrase in the query), then also try querying containers, and display + # a "were you looking for" box with a single result container_found = None - if request.args.get("generic"): + filter_only_query = True + for p in request.args.get("q", "").split(): + if not ":" in p: + filter_only_query = False + break + if request.args.get("generic") and not filter_only_query: container_query = GenericQuery.from_args(request.args) container_query.limit = 1 try: -- cgit v1.2.3