commit 980c6b4aa6c39cc366fe44febc21d64fdbb425d7
parent e2ec756bbdcae99d21e7f7157f9e6fb306981dc3
Author: René Wagner <rwa@clttr.info>
Date: Fri, 10 Jun 2022 19:54:05 +0200
disable search suggestions due to bug
Diffstat:
3 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/serve/templates/news.gmi b/serve/templates/news.gmi
@@ -2,6 +2,10 @@
## News
+### 2022-06-07 suggestions disabled
+The poor performance on "no result searches" was caused by some misbehaviour when trying to compute suggestions for alternate search terms which eventually led to an exception.
+I disabled suggestions for empty search results for the moment. Suggestions will come back once i sorted this out.
+
### 2022-05-16
there's currently an issue with search querys that will lead to no results (e.g. geminispace.info can't find a page that matches the criterias):
These searches will take a very long time to a "no results" is returned, sometimes they will even fail with a "42 TEMPORARY FAILURE".
diff --git a/serve/templates/search.gmi b/serve/templates/search.gmi
@@ -29,9 +29,6 @@
{% else %}
No results!
-{% for suggestion in search_suggestions %}
-=> /search?{{ suggestion }} GUS: {{ suggestion }}
-{% endfor%}
{% endfor %}
{% include 'fragments/pager.gmi' %}
diff --git a/serve/views.py b/serve/views.py
@@ -208,30 +208,30 @@ def search(request):
verbose = compute_verbose(request.path)
requested_page = compute_requested_results_page(request.path)
num_results, results = gus.search_index(request.query, requested_page)
- if num_results > 0:
- num_pages = math.ceil(num_results / 10)
- current_page = min(requested_page, num_pages)
- if num_results == 0:
- current_page = 0
- body = render_template(
- "search.gmi",
- query=request.query,
- quoted_query=quote(request.query),
- verbose=verbose,
- num_results=num_results,
- results=results,
- current_page=current_page,
- num_pages=num_pages,
- index_modification_time=gus.statistics["index_modification_time"]
- )
- else:
- search_suggestions = gus.get_search_suggestions(request.query)
- body = render_template(
- "search_suggestions.gmi",
- query=request.query,
- search_suggestions=search_suggestions,
- index_modification_time=gus.statistics["index_modification_time"]
- )
+ #if num_results > 0:
+ num_pages = math.ceil(num_results / 10)
+ current_page = min(requested_page, num_pages)
+ if num_results == 0:
+ current_page = 0
+ body = render_template(
+ "search.gmi",
+ query=request.query,
+ quoted_query=quote(request.query),
+ verbose=verbose,
+ num_results=num_results,
+ results=results,
+ current_page=current_page,
+ num_pages=num_pages,
+ index_modification_time=gus.statistics["index_modification_time"]
+ )
+ #else:
+ # search_suggestions = gus.get_search_suggestions(request.query)
+ # body = render_template(
+ # "search_suggestions.gmi",
+ # query=request.query,
+ # search_suggestions=search_suggestions,
+ # index_modification_time=gus.statistics["index_modification_time"]
+ # )
return body
def deferred_search():