Ensure additional content fields get indexed
This commit is contained in:
parent
863b0f67c5
commit
cf0a365277
4 changed files with 15 additions and 0 deletions
|
@ -24,6 +24,7 @@ class BlogListPage(BaseContentMixin, RoutablePageMixin, BasePage): # type: igno
|
|||
"blog.BlogCollectionPage",
|
||||
]
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
@cached_property
|
||||
def reading_time(self) -> int:
|
||||
|
@ -71,6 +72,7 @@ class BlogListPage(BaseContentMixin, RoutablePageMixin, BasePage): # type: igno
|
|||
class BlogPostPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
||||
subpage_types: list[Any] = []
|
||||
parent_page_types = [BlogListPage, "blog.BlogCollectionPage"]
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
tags = ParentalManyToManyField("blog.BlogPostTagPage", blank=True)
|
||||
date = models.DateField(default=timezone.now)
|
||||
|
@ -88,6 +90,7 @@ class BlogPostTagListPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
|||
subpage_types = ["blog.BlogPostTagPage"]
|
||||
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
@cached_property
|
||||
def table_of_contents(self) -> list[TocEntry]:
|
||||
|
@ -107,6 +110,7 @@ class BlogPostTagPage(BaseContentMixin, RoutablePageMixin, BasePage): # type: i
|
|||
parent_page_types = [BlogPostTagListPage]
|
||||
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
@cached_property
|
||||
def table_of_contents(self) -> list[TocEntry]:
|
||||
|
@ -138,6 +142,7 @@ class BlogCollectionListPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
|||
max_count = 1
|
||||
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
@cached_property
|
||||
def table_of_contents(self) -> list[TocEntry]:
|
||||
|
@ -160,6 +165,7 @@ class BlogCollectionPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
|||
subpage_types = [BlogPostPage]
|
||||
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
@cached_property
|
||||
def table_of_contents(self) -> list[TocEntry]:
|
||||
|
|
|
@ -54,6 +54,11 @@ class BaseContentMixin(models.Model):
|
|||
FieldPanel("body"),
|
||||
]
|
||||
|
||||
search_fields = [
|
||||
index.SearchField("body"),
|
||||
index.SearchField("subtitle"),
|
||||
]
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
@ -100,10 +105,12 @@ class BaseContentMixin(models.Model):
|
|||
class ContentPage(BasePage, BaseContentMixin): # type: ignore[misc]
|
||||
subpage_types: list[Any] = []
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
|
||||
class ListingPage(BasePage, BaseContentMixin): # type: ignore[misc]
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
def get_context(self, request: HttpRequest) -> dict:
|
||||
context = super().get_context(request)
|
||||
|
|
|
@ -40,6 +40,7 @@ class ContactPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
|||
max_count = 1
|
||||
subpage_types: list = []
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
@cached_property
|
||||
def reading_time(self) -> int:
|
||||
|
|
|
@ -15,6 +15,7 @@ class SearchPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
|||
subpage_types: list = []
|
||||
parent_page_types = ["home.HomePage"]
|
||||
content_panels = BasePage.content_panels + BaseContentMixin.content_panels
|
||||
search_fields = BasePage.search_fields + BaseContentMixin.search_fields
|
||||
|
||||
@cached_property
|
||||
def reading_time(self) -> int:
|
||||
|
|
Loading…
Reference in a new issue