From e67c47a640af1e1d46ba61fae38f6fcd3402c930 Mon Sep 17 00:00:00 2001 From: Ammar Ammar <43293485+ammar257ammar@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:13:36 +0000 Subject: [PATCH 1/2] Remove headline from search results items --- .../templates/documentation/docpage_detail.html | 1 - app/grandchallenge/documentation/views.py | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/grandchallenge/documentation/templates/documentation/docpage_detail.html b/app/grandchallenge/documentation/templates/documentation/docpage_detail.html index e19d115243..4a9b6b0483 100644 --- a/app/grandchallenge/documentation/templates/documentation/docpage_detail.html +++ b/app/grandchallenge/documentation/templates/documentation/docpage_detail.html @@ -139,7 +139,6 @@ {% for result in search_results %}
{{ result.title }}
-
{{ result.headline|clean }}
{% endfor %} {% else %} diff --git a/app/grandchallenge/documentation/views.py b/app/grandchallenge/documentation/views.py index 01c0a69460..d7297b607a 100644 --- a/app/grandchallenge/documentation/views.py +++ b/app/grandchallenge/documentation/views.py @@ -1,6 +1,5 @@ from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.postgres.search import ( - SearchHeadline, SearchQuery, SearchRank, SearchVector, @@ -44,10 +43,8 @@ def get_context_data(self, **kwargs): if keywords: query = SearchQuery(keywords) vector = SearchVector("title", "content") - headline = SearchHeadline("content", query) qs = ( - qs.annotate(headline=headline) - .annotate(rank=SearchRank(vector, query)) + qs.annotate(rank=SearchRank(vector, query)) .annotate( similarity=TrigramSimilarity("title", keywords) + TrigramSimilarity("content", keywords) From af3735f80091573cdff68bb18a52b5378cfbf147 Mon Sep 17 00:00:00 2001 From: Ammar Ammar <43293485+ammar257ammar@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:15:11 +0000 Subject: [PATCH 2/2] Fix padding --- .../documentation/templates/documentation/docpage_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/grandchallenge/documentation/templates/documentation/docpage_detail.html b/app/grandchallenge/documentation/templates/documentation/docpage_detail.html index 4a9b6b0483..e2d6729ffa 100644 --- a/app/grandchallenge/documentation/templates/documentation/docpage_detail.html +++ b/app/grandchallenge/documentation/templates/documentation/docpage_detail.html @@ -138,7 +138,7 @@ {% if search_results %} {% for result in search_results %}
-
{{ result.title }}
+
{{ result.title }}
{% endfor %} {% else %}