Index tags and boost subtitle
This commit is contained in:
parent
1e2e488516
commit
66465dafe8
1 changed files with 5 additions and 0 deletions
|
@ -5,6 +5,7 @@ from django.utils import timezone
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from modelcluster.fields import ParentalManyToManyField
|
from modelcluster.fields import ParentalManyToManyField
|
||||||
from wagtail.admin.panels import FieldPanel
|
from wagtail.admin.panels import FieldPanel
|
||||||
|
from wagtail.search import index
|
||||||
from wagtailautocomplete.edit_handlers import AutocompletePanel
|
from wagtailautocomplete.edit_handlers import AutocompletePanel
|
||||||
|
|
||||||
from website.common.models import BaseContentPage, BaseListingPage
|
from website.common.models import BaseContentPage, BaseListingPage
|
||||||
|
@ -57,6 +58,10 @@ class BlogPostPage(BaseContentPage):
|
||||||
AutocompletePanel("tags"),
|
AutocompletePanel("tags"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
search_fields = BaseContentPage.search_fields + [
|
||||||
|
index.RelatedFields("tags", [index.SearchField("title", boost=1)])
|
||||||
|
]
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def tag_list_page_url(self) -> Optional[str]:
|
def tag_list_page_url(self) -> Optional[str]:
|
||||||
return SingletonPageCache.get_url(BlogPostTagListPage)
|
return SingletonPageCache.get_url(BlogPostTagListPage)
|
||||||
|
|
Loading…
Reference in a new issue