Skip to content

Commit

Permalink
Simplified some things
Browse files Browse the repository at this point in the history
  • Loading branch information
david-okeke1337 committed Dec 17, 2024
1 parent d644bb3 commit 1a5ce21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/search/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions src/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 1a5ce21

Please sign in to comment.