From b13fe49664fbf50eaf909912c1257561bf0a5f27 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 25 Dec 2023 22:10:17 +0000 Subject: [PATCH] Exclude listing pages from search --- website/search/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/website/search/models.py b/website/search/models.py index 1dcbe64..b8c4488 100644 --- a/website/search/models.py +++ b/website/search/models.py @@ -9,7 +9,7 @@ from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.models import Page from wagtail.search.utils import parse_query_string -from website.common.models import BaseContentPage +from website.common.models import BaseContentPage, BaseListingPage from website.common.utils import get_page_models from .serializers import MIN_SEARCH_LENGTH, SearchParamsSerializer @@ -22,7 +22,10 @@ class SearchPage(RoutablePageMixin, BaseContentPage): PAGE_SIZE = 12 # Exclude singleton pages from search results - EXCLUDED_PAGE_TYPES = {page for page in get_page_models() if page.max_count == 1} + EXCLUDED_PAGE_TYPES = { + *(page for page in get_page_models() if page.max_count == 1), + BaseListingPage, + } @cached_property def show_reading_time(self) -> bool: