Making searchindex.js smaller
Open
Nobody has claimed this yet.
C-enhancement
- Dominant language
- Rust
- Stars
- 22.2k
- Forks
- 1.9k
- PR merge metrics
- PR metrics pending
Description
Problem
The file searchindex.js used for searching is quite big. e.g. for one of my books it is 2,052,190 bytes.
Proposed Solution
Two ideas:
- The
{"body":27,"breadcrumbs":6,"title":2}appears quite a few times in the data. We might change that mapping to an array [27, 6, 12]. - The whole JSON might be minified before we store it in the js file.
Notes
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading searchindex.js and identify how repeated field mappings and JSON formatting contribute to its size. Compare the proposed array representation and minified output, then verify that the generated index remains usable for searching while being smaller.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust
- Domain
- performance, search
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100