CosineLive demo, free and Pro.
Everything below runs in your browser: the index of the Cosine and Surjection docs, keyword search, and, once you load it, the embedding model that searches by meaning. There is no search server.
Your queries are not sent anywhere. Loading the model downloads about 23 MB from Hugging Face once; your browser caches it.
Search
The search field (free, MIT)Try it, then load the model.
This is <cosine-search>, the web component from @sweberdev/cosine, on an index of 28 documentation pages. Keyword results appear on the first keystroke. Load the model and the same field also finds sections that use other words than your query. Press / to focus it.
Keyword search only. Load the model to search by meaning.
In a real site the section vectors are computed once at build time with `cosine build`. This demo computes them in your browser after the download, which takes a few seconds.
Keyword vs. meaning
Pick a question or type your own. The left column is classic keyword search (BM25), as in most static-site search tools. The right column is Cosine's hybrid ranking: keywords and embeddings fused, so a question finds the section that answers it.
Example questions
Insights
Search insights (Pro)What your docs are missing.
@weber-development/cosine-insights records which searches find nothing and which results nobody opens, without cookies, ids or IP addresses, and turns them into a report. The example below was made from a month of made-up searches on a docs site.
npx cosine-insights report --log data/searches.ndjson --out insights.htmlNext
Add it to your docsTwo commands and one tag.
Build the index with npx cosine build docs --out public/cosine, add <cosine-search index="/cosine/cosine-index.json"> to your layout, done. Cosine Pro builds the index in every Vite build and adds search insights.