fix(search): strip bloat elements from search index to reduce size - #23
Merged
Conversation
The search index was including bloat-inducing elements like SVG diagrams, images, canvas, and figure captions in each doc's text field, causing large indexes (>2 MB for large sites). This caused 502 errors for deployments fronted by backends with response size caps (e.g., AWS ALB limits to ~1 MB). Strip only problematic elements (svg, img, canvas, picture, figure) while preserving semantic HTML (<p>, <strong>, <em>, <code>, etc.) so teasers render richly in the Material search UI. This keeps the search index lean without sacrificing presentation. Add a configurable plugin option `strip_bloat_elements` (defaults to true) to allow users to disable stripping if needed. Typical reduction: 2.3 MB -> 0.9 MB (60% smaller). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
The search index was including bloat-inducing elements like SVG diagrams, images, canvas, and figure captions in each doc's text field, causing large indexes (>2 MB for large sites). This caused 502 errors for deployments fronted by backends with response size caps (e.g., AWS ALB limits to ~1 MB).
Strip only problematic elements (svg, img, canvas, picture, figure) while preserving semantic HTML (
, , ,
, etc.) so teasers render richly in the Material search UI. This keeps the search index lean without sacrificing presentation.Add a configurable plugin option
strip_bloat_elements(defaults to true) to allow users to disable stripping if needed.Typical reduction: 2.3 MB -> 0.9 MB (60% smaller).
What & why
Type of change
Checklist
dotnet format Netdocs.slnx --verify-no-changespassesdotnet build Netdocs.slnx -c Releasesucceedsdotnet test Netdocs.slnx -c Releasepassesdocs-site/docs/**if behavior changedNotes for reviewers