From 8407f04627d54d75501b1731a8cf6c0d78eebf1f Mon Sep 17 00:00:00 2001 From: Marcel Kornblum Date: Mon, 27 Nov 2023 11:33:19 +0000 Subject: [PATCH] Turn off bad results (#522) also re-raise setTimeout --- .../templates/search/partials/search_form.html | 2 +- src/search/templatetags/search.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/search/templates/search/partials/search_form.html b/src/search/templates/search/partials/search_form.html index e3699ebe0..57d0e1358 100644 --- a/src/search/templates/search/partials/search_form.html +++ b/src/search/templates/search/partials/search_form.html @@ -12,7 +12,7 @@ hx-trigger="input keyup changed delay:150ms" hx-get="{% url 'search:autocomplete' %}" hx-target="#autocomplete-results" - onblur="setTimeout(() => {document.getElementById('autocomplete-results').style.display='none'}, 100)" + onblur="setTimeout(() => {document.getElementById('autocomplete-results').style.display='none'}, 250)" onfocus="document.getElementById('autocomplete-results').style.display='block'">
diff --git a/src/search/templatetags/search.py b/src/search/templatetags/search.py index 3b9ace073..8d7471c35 100644 --- a/src/search/templatetags/search.py +++ b/src/search/templatetags/search.py @@ -5,7 +5,8 @@ from django.core.paginator import Paginator from search import search as search_vectors -from search.utils import has_only_bad_results + +# from search.utils import has_only_bad_results register = template.Library() @@ -85,12 +86,12 @@ def search_category( "search_query": query, "count": count, "is_results_count_low": count < settings.CUTOFF_SEARCH_RESULTS_VALUE, - "show_bad_results_message": ( - show_bad_results_message - and has_only_bad_results( - query, category, pinned_results, search_vector_results - ) - ), + "show_bad_results_message": False, # ( + # show_bad_results_message + # and has_only_bad_results( + # query, category, pinned_results, search_vector_results + # ) + # ), "show_heading": show_heading, "result_type_display": result_type_display, "is_limited": limit is not None and count > limit,