Skip to content

Add a search page that can be linked to with ?q= - #5

Merged
notleowang merged 2 commits into
site-searchfrom
search-page
Nov 27, 2026
Merged

notleowang merged 2 commits into
site-searchfrom
search-page

Conversation

@notleowang

Copy link
Copy Markdown
Collaborator

Description

Adds a search page for the review from @stockholmux on valkey-io#723, to be merged into site-search. Follows #3 and #4.

/search/?q=<query> shows the search results for <query>, so a search can be linked to and shared.

  • Same results as the search modal: the same result template (now a shared include), ranking, keyword boosts and exact title matches first.
  • The address follows the search: q updates once typing pauses (on <pagefind-input>'s 300 ms debounce). It uses replaceState, so Back still goes to the previous page rather than through each search. Clearing the search removes q.
  • Separate from the header search: the page uses its own Pagefind instance, so searching in the header on the search page doesn't change the page's results.
  • Not in the search index itself: the page is excluded from the index and marked so build/check-search-index.py doesn't expect it.

Review items

  • 4. A search page, or a way to start a search from the URL
  • 2. Search analytics: not included. The page gives searches a URL with a q parameter, which Google Analytics' site search tracking can read, so tracking can be added on top of it later.

Backlog

  • A "See all results" link in the search modal that opens /search/?q=….

Testing

Built locally (Zola 0.23.6, Pagefind 1.6.0) and checked in headless Chrome and in the browser:

  • /search/?q=migration shows "migration" in the search box, "65 results for migration", and Migration from Redis to Valkey first.
  • /search/ shows an empty, focused search box and no results.
  • Searching updates q (for example ?q=acl+setuser, with ACL SETUSER first), without adding history entries. Clearing removes q.
  • Searching in the header modal on the search page leaves the page's results and address unchanged.
  • The modal's markup is unchanged by the shared template. The result breadcrumb looks the same on the page as in the modal.
  • build/check-search-index.py: 794 pages indexed, 0 problems, with /search/ not indexed. All 26 ranking cases pass.

Check List

  • Commits are signed per the DCO using --signoff

The result template was part of the modal's include. It's now
templates/includes/search-result.html, which the modal includes, so the
upcoming search page can show results with the same template.

The modal's markup is unchanged.

Signed-off-by: notleowang <leo.wang@improving.com>
/search/?q=<query> shows the search results for <query>, so a search
can be linked to and shared. It shows the same results as the search
modal, with the same template, ranking, keyword boosts and exact title
matches first. q follows what's typed once typing pauses, on
<pagefind-input>'s debounce, with replaceState so Back still goes to the
previous page.

The page uses its own Pagefind instance, so searching in the header on
the search page doesn't change the page's results. search.js now sets up
each instance the same way. The page's elements are in a <template>, as
the modal's are, so their instance is configured before they start.

The page isn't indexed itself. It's marked data-search-unindexed, which
build/check-search-index.py now skips. The result breadcrumb's style
applies on the page as well as in the modal.

Signed-off-by: notleowang <leo.wang@improving.com>
@notleowang notleowang self-assigned this Nov 27, 2026
@notleowang
notleowang merged commit 2df78ac into site-search Nov 27, 2026
@notleowang
notleowang deleted the search-page branch November 27, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant