Skip to main content

How Docsense works

Docsense has two stages: index at build time, then search in the browser.

Build time​

When you run docusaurus start or docusaurus build, the plugin:

  1. Scans the docs directories you set in docsDirs (default: docs)
  2. Parses each Markdown or MDX file into a structured record (title, sections, body, page type)
  3. Writes static/docsense/search-index.json (path is configurable)

That file is a normal static asset. Deploy it with the rest of your site.

Runtime​

When a reader opens search:

  1. The SearchBar loads the JSON index once (lazy load)
  2. Each query runs in memory with tokenization, fuzzy matching, and ranking
  3. The modal shows page-level results, optional filters, and the page limit you choose

There is no Docsense API server. If the static index file is available, search works.

Packages​

PackageRole
@docsense/coreTokenize, rank, and search()
@docsense/indexerParse Markdown/MDX and build the index
@docsense/runtimeBrowser/Node client that loads the JSON file
docusaurus-plugin-docsenseWires indexing into Docusaurus and provides the SearchBar

Most sites only install the plugin. The other packages are used underneath, or when you want a custom UI.

Hosted search (for example Algolia DocSearch)Docsense
External crawler or push APIIndex during your docs build
Query hits a cloud serviceQuery runs in the browser
Freshness depends on crawl or sync jobsFreshness matches your last deploy

Choose hosted search when you need a managed platform at large scale. Choose Docsense when you want search to stay inside your docs build and deploy.

For the full open-source comparison (Docsense vs easyops, Orama, Pagefind, and DocSearch), see Compare open-source Docusaurus search.

Next steps​