From 66465dafe82f660e9372f210b4250cbd17a68b9a Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 31 Oct 2022 20:58:02 +0000 Subject: [PATCH] Index tags and boost subtitle --- website/blog/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/blog/models.py b/website/blog/models.py index 44e0ab0..f99d4e9 100644 --- a/website/blog/models.py +++ b/website/blog/models.py @@ -5,6 +5,7 @@ from django.utils import timezone from django.utils.functional import cached_property from modelcluster.fields import ParentalManyToManyField from wagtail.admin.panels import FieldPanel +from wagtail.search import index from wagtailautocomplete.edit_handlers import AutocompletePanel from website.common.models import BaseContentPage, BaseListingPage @@ -57,6 +58,10 @@ class BlogPostPage(BaseContentPage): AutocompletePanel("tags"), ] + search_fields = BaseContentPage.search_fields + [ + index.RelatedFields("tags", [index.SearchField("title", boost=1)]) + ] + @cached_property def tag_list_page_url(self) -> Optional[str]: return SingletonPageCache.get_url(BlogPostTagListPage)