Replace Sphinx search with Pagefind#1266
Open
KiaraGrouwstra wants to merge 1 commit into
Open
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 |
Collaborator
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. - `pagefind.yml`: scope indexing to the article body, exclude UI chrome. - `default.nix`: add `pkgs.pagefind` to `nativeBuildInputs` (also exposes it in the dev shell via `inputsFrom`). - `Makefile`: run `pagefind --site build/html` after `sphinx-build` in the `html` target 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. Assisted-by: Claude:claude-opus-4-8
3b7fe1f to
9e477fb
Compare
Contributor
Author
i bumped the snippets up to 30 words now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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