Skip to main content

Module search_index

Module search_index 

Source
Expand description

Vector-search artifact emitter (issue #545).

Walks the compiled site for HTML files, runs the ssg-search encoder over each page’s visible text, and writes the four-file WASM-loadable bundle to <site>/search/:

  • embeddings.bin — pre-normalised f32 vectors, little-endian.
  • manifest.json — row index → {url, title, excerpt} map.
  • model.bin — encoder weights / config (with magic header).
  • tokenizer.bin — tokeniser config (with magic header).

Intended to run alongside crate::search::SearchPlugin (which is a separate keystroke-based lexical search). The two coexist — search-index.json powers the modal autocomplete, search/embeddings.bin powers the semantic ranked results returned by the WASM engine.

§Why a separate plugin

The vector bundle is large (one f32 per dim per doc) so it ships to the browser separately and lazily — never inlined into HTML — and the worker fetches it the first time the user types. The existing SearchPlugin is on every page; this plugin is opt-in via crate::plugin::PluginManager::register.

Structs§

VectorSearchPlugin
Plugin that builds the <site>/search/ vector bundle.