aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-02-15 13:39:39 -0800
committerBryan Newbold <bnewbold@robocracy.org>2022-02-15 13:40:42 -0800
commita7e66854de844eb6eb663e07d65f0b140ab8f149 (patch)
treeced5ef847ebd491f0a9d1418bb9bc7b49df624a5 /python/fatcat_web/routes.py
parentf9dc23aab85516a08fa17ab26796b93cbc610e8f (diff)
downloadfatcat-a7e66854de844eb6eb663e07d65f0b140ab8f149.tar.gz
fatcat-a7e66854de844eb6eb663e07d65f0b140ab8f149.zip
web: tweak 'generic' / container mix-in search result behavior
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py11
1 files changed, 10 insertions, 1 deletions
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: