Skip to content

feat: support create on-demand search#311

Closed
bxb100 wants to merge 1 commit into
huhu:masterfrom
bxb100:on-demand-search
Closed

feat: support create on-demand search#311
bxb100 wants to merge 1 commit into
huhu:masterfrom
bxb100:on-demand-search

Conversation

@bxb100

@bxb100 bxb100 commented Jun 5, 2026

Copy link
Copy Markdown

Since rust-lang/rust#144476 started using stringdex for on-demand search,

this extension's original search-index.js is not working anymore. So, I think maybe using on-demand search with the extension sandbox is a good idea, because the separte index script is small and can be cached by the browser, and naturally, the query is a single activity (it only supports @crate query), so the speed is not a problem.

Currently implementing only tests in Chrome.

Important

This code was generated by Codex; it is just an experimental test, not for merge.

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
@bxb100

bxb100 commented Jun 5, 2026

Copy link
Copy Markdown
Author

The docs.rs load search stringdex root-index depend on page data

https://github.com/rust-lang/rust/blob/794301af24b1ce06642419541b8f10d77aca939c/src/librustdoc/html/static/js/main.js#L415-L422

function getVar(name) {
    const el = document.querySelector("head > meta[name='rustdoc-vars']");
    const v = el ? el.getAttribute("data-" + name) : null;
    if (v !== null) {
        return v;
    }
    throw `rustdoc var "${name}" is missing`;
}

Current code does not deal with this compatibility problem, but I don't think assembling all index js files into a flat JSON to cache is a good idea

@bxb100 bxb100 closed this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant