diff --git a/src/search/utils.py b/src/search/utils.py index b9fe680b8..3577e30da 100644 --- a/src/search/utils.py +++ b/src/search/utils.py @@ -252,14 +252,11 @@ def has_only_bad_results(query, category, pinned_results, search_results): def get_content_owner(page) -> dict: - content_owner = { - "name": "", - "email": "", + page_content_owner = getattr(page, "content_owner", None) + return { + "name": page_content_owner.full_name if page_content_owner else "", + "email": page_content_owner.email if page_content_owner else "", } - if page_content_owner := getattr(page, "content_owner", None): - content_owner["name"] = page_content_owner.full_name - content_owner["email"] = page_content_owner.email - return content_owner def get_content_author(page) -> dict: diff --git a/src/search/views.py b/src/search/views.py index 3192836c0..e522ba09c 100644 --- a/src/search/views.py +++ b/src/search/views.py @@ -154,8 +154,10 @@ def export_search(request: HttpRequest, category: str) -> HttpResponse: query = request.GET.get("query", "") if category == "all": - category = "all_pages" - search_vector = search_template_tag.SEARCH_VECTORS[category](request) + search_vector = search_template_tag.SEARCH_VECTORS["all_pages"](request) + else: + search_vector = search_template_tag.SEARCH_VECTORS[category](request) + search_results = search_vector.search(query) search_model = search_vector.model