Replace Sphinx search with Pagefind - #1266
Conversation
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/discussion-of-flakes-from-2025-nixos-community-survey-report/78853/40 |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/discussion-of-flakes-from-2025-nixos-community-survey-report/78853/41 |
3b7fe1f to
9e477fb
Compare
i bumped the snippets up to 30 words now |
9e477fb to
68aa07b
Compare
Sphinx's stock client-side search stems and splits identifiers like system.nix into ubiquitous terms (system + nix) and stores no positional data, so phrase/identifier ranking is impossible: searching system.nix did not rank guides/recipes/dependency-management.html, which contains the exact string. Pagefind indexes the rendered HTML post-build and does real phrase/proximity ranking. Searching system.nix now ranks that page first. Assisted-by: Claude:claude-opus-4-8
68aa07b to
884754d
Compare
|
@KiaraGrouwstra : Resolved the conflicts. Most notably i changed the description of your original commit message. I tested the change locally. Using pagefind makes sense to me, it also aligns better with the upcoming docs.nixos.org |


Sphinx's stock client-side search stems and splits identifiers like
system.nixinto ubiquitous terms (system+nix) and stores no positional data, so phrase/identifier ranking is impossible: searchingsystem.nixdid not (highly) rankguides/recipes/dependency-management.html, which contains the exact string.Pagefind indexes the rendered HTML post-build and does real phrase/proximity ranking. Searching
system.nixnow ranks that page first.pagefind.yml: scope indexing to the article body, exclude UI chrome.default.nix: addpkgs.pagefindtonativeBuildInputs(also exposes it in the dev shell viainputsFrom).Makefile: runpagefind --site build/htmlaftersphinx-buildin thehtmltarget for local/CI parity, guarded with a clear error if the binary is missing.source/_templates/search.html: replace the Sphinx search page with a Pagefind UI, dropping the now-unused Sphinx search scripts and pre-filling from?q=so the sidebar search box still works.Verifying:
nix-shell --run 'make html' && python3 -m http.server -d build/html 8000Assisted-by: Claude:claude-opus-4-8