Documentation menuDocumentation
Cosine documentation
Semantic search for documentation sites that runs entirely in the browser. No search server, no API key, no query leaves the device.
Try the live demoStart
Guides
- Building the indexWhat cosine build reads, how it splits pages and how to run it in CI.
- Models and languagesWhich embedding model to choose for English, German, French or Italian documentation.
- Search fieldThe <cosine-search> web component, its attributes, styling and events.
- ReactThe CosineSearch component and the useCosine / useCosineSearch hooks.
- Privacy and self-hostingWhat leaves the browser, and how to serve the model from your own domain.
- RecipesShort setups for Next.js, Astro, VitePress, Docusaurus, SvelteKit, Vue and plain HTML.
- Migrating to CosineMove from Pagefind, Orama, MiniSearch or Lunr to Cosine, with a mapping of concepts and an honest list of what you gain and lose.
- TroubleshootingSymptoms and fixes for missing results, a model that does not load, CORS, base paths, large indexes and hidden filters.
Reference
- CLIcosine build and cosine search.
- JavaScript APIloadIndex, Cosine, buildIndex and the helpers.
- StabilityWhat the 1.x versions of Cosine promise, what is frozen, what is experimental and how a test enforces it.
- PerformanceIndex size, build time and search time, measured by the benchmarks that run in CI.
- UpgradingWhat changed in each version from 0.1 to 1.0 and what you need to do.
- Migrating to 2.0What changes in Cosine 2.0, who is affected and what to do, step by step.
Cosine Pro
- Cosine ProPlugins for Vite, Next.js, Docusaurus, VitePress and Astro, per-language models, and search insights that show what your docs are missing.
- Vite pluginBuild the index as part of every Vite build, with a dev server and an embedding cache.
- Next.jsBuild the index from the pages next build has prerendered, and keep it fast in CI.
- Migrating from AlgoliaTurn an Algolia DocSearch export into a Cosine index without crawling your site again.
- Search insightsFind out which questions your docs do not answer, without tracking people.
- Short answersShow the sentence that answers the question above the search results, without an LLM and without a server.
- Search qualityWrite down which page must answer which query and let CI tell you when a change makes search worse.
- LanguagesOne index per page language, each with its own model, so visitors download only the model of the language they read.
- docusaurus
- vitepress
- Astro and StarlightReplace the Starlight search with Cosine, build the index with cache and shards, and pick the model per page language.