feat: implement article search with PostgreSQL full-text search
Some checks failed
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / ci (pull_request) Failing after 1m21s
CI / pr-e2e (pull_request) Successful in 1m33s

- Configure Wagtail database search backend with English search config
- Add django.contrib.postgres to INSTALLED_APPS for full PG FTS support
- Expand ArticlePage.search_fields: body_text (excl. code blocks),
  AutocompleteField(title), RelatedFields(tags), FilterFields
- Add search view at /search/?q= with query guards (strip, max 200 chars,
  empty/whitespace handling) and pagination preserving query param
- Replace nav Subscribe CTA with compact search box (desktop + mobile)
- Add search box to article index page alongside category/tag filters
- Create search results template reusing article_card component
- Add update_index to deploy entrypoint for automated reindexing
- Update existing tests for nav change, add comprehensive search tests

Closes #41

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Mark
2026-03-03 21:25:11 +00:00
parent eebd5c9978
commit 906206d4cd
11 changed files with 299 additions and 8 deletions

View File

@@ -37,11 +37,10 @@ def test_theme_toggle_adds_dark_class(page: Page, base_url: str) -> None:
@pytest.mark.e2e
def test_nav_subscribe_cta_present(page: Page, base_url: str) -> None:
def test_nav_search_box_present(page: Page, base_url: str) -> None:
page.goto(f"{base_url}/", wait_until="networkidle")
nav = page.locator("nav")
# Nav has a Subscribe CTA link (not a form — wireframe spec)
expect(nav.get_by_role("link", name="Subscribe")).to_be_visible()
expect(nav.locator('input[name="q"]')).to_be_visible()
@pytest.mark.e2e