diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2022-02-15 13:39:39 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2022-02-15 13:40:42 -0800 |
commit | a7e66854de844eb6eb663e07d65f0b140ab8f149 (patch) | |
tree | ced5ef847ebd491f0a9d1418bb9bc7b49df624a5 | |
parent | f9dc23aab85516a08fa17ab26796b93cbc610e8f (diff) | |
download | fatcat-a7e66854de844eb6eb663e07d65f0b140ab8f149.tar.gz fatcat-a7e66854de844eb6eb663e07d65f0b140ab8f149.zip |
web: tweak 'generic' / container mix-in search result behavior
-rw-r--r-- | python/fatcat_web/routes.py | 11 |
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: |