Conversation
… blocks
The client-side search index had grown to 16.3 MB raw / ~4.5 MB wire
(4,500+ docs), giving 25-30 s of blank UI before first results — users
read the dead window as 'search is broken entirely' (the engine itself
returned correct results).
Three levers, all config-only:
- searchContextByPaths: per-section index chunks. Searching from any
docs page now fetches only that section's index (e.g. Reference:
1.4 MB / 387 KB gz) instead of the 16 MB monolith. The search page
gains a section dropdown; landing-page searches still cover
everything via useAllContextsWithNoSearchContext.
- ignoreCssSelectors: ['pre']: fenced code blocks no longer indexed.
YAML/shell samples were generating huge high-cardinality lunr token
dictionaries; inline code in prose stays searchable.
- ignoreFiles: user-stories excluded (527 index docs of scraped
community quotes rendered by a React component).
Measured (npm run build, both locales):
- root 'Everywhere' index: 16.3 MB -> 13.2 MB raw (4.42 -> 3.57 MB gz)
- per-section indexes: 0.4-8.3 MB raw (103 KB-2.2 MB gz)
- zh-Hans root: 14.6 -> 12.6 MB raw
- local serve: first dropdown results in ~175-205 ms for both scoped
and Everywhere queries ('telegram' -> 8 options, search page -> 100)
Contributor
૮ >ﻌ< ა ci reviewran on a9d9634
|
1 task
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.
What does this PR do?
Makes docs search feel instant again. The client-side search index had grown to 16.3 MB raw / ~4.5 MB over the wire (4,500+ indexed docs), and since
@easyops-cn/docusaurus-search-localshows no spinner, users stared at a completely blank search page for 25-30 seconds before the (correct) results popped in — indistinguishable from "search is broken entirely".Three config-only levers in
website/docusaurus.config.ts:searchContextByPaths— the index is now built per section (user-guide, developer-guide, guides, reference, getting-started, integrations). Searching from any docs page fetches only that section's index (e.g. Reference: 1.4 MB raw / 387 KB gz) instead of the 16 MB monolith. The search page gains a section scope dropdown; searches started outside a section (docs landing page) still cover everything viauseAllContextsWithNoSearchContext: true.ignoreCssSelectors: ['pre']— fenced code blocks are no longer indexed. YAML/shell/config samples were generating huge high-cardinality lunr token dictionaries for text nobody searches literally. Inlinecodein prose (command names, config keys) stays searchable.ignoreFiles+user-stories— the community-quote collage page contributed 527 index documents of scraped testimonials that polluted results for generic terms.Related Issue
Follow-up to #65103 (fuzzy-distance fix) — same disease, next stage: full-content client-side indexing doesn't scale with the docs tree. This buys headroom now; Algolia DocSearch remains the long-term answer.
Type of Change
Changes Made
website/docusaurus.config.ts: addedsearchContextByPaths(6 sections),useAllContextsWithNoSearchContext: true,ignoreCssSelectors: ['pre'], and/^user-stories/inignoreFiles. Config-only; no dependency or code changes.How to Test
cd website && npm ci && npm run buildsearch-index-*.jsonfiles exist inbuild/alongside the root index.build/under/docs/and search "telegram" from a docs page — results should appear in well under a second.Measured results (local build, both locales)
Time-to-first-dropdown-result on a local serve: ~175 ms searching "telegram" from a section page, ~205 ms from the landing page (was 25-30 s of blank UI on the live site). Search-page query returns the full 100 results with the new scope selector rendering correctly.
The root index still exists as the "Everywhere" fallback, so worst case is strictly better than before; the common case (searching while reading a section) downloads 87-97% less.
Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys — N/AInfographic