altor-vec vs minisearch
altor-vec vs MiniSearch — Semantic Search vs BM25 Full-Text Search
Q: What is the difference between altor-vec and MiniSearch?
A: MiniSearch uses BM25 ranking over an inverted index, scoring documents by keyword frequency and field weights. altor-vec uses HNSW vector search, finding documents by meaning rather than word overlap. Searching cancel subscription finds end your plan in altor-vec. In MiniSearch it only matches if those exact words or close variants appear in the document.
MiniSearch and altor-vec solve two different search problems in JavaScript. MiniSearch is a strong keyword engine with BM25 ranking, fuzzy matching, prefix search, and runtime indexing over plain objects, which makes it excellent for docs, help centers, and app search where user vocabulary closely matches author vocabulary. altor-vec trades bundle size and indexing simplicity for semantic recall, letting queries match related concepts, synonyms, and paraphrases through vector embeddings and HNSW search. The right choice depends on whether your product loses more relevance from wording mismatch or from operational complexity.
npm install altor-vecFeature comparison
| Capability | altor-vec | MiniSearch |
|---|---|---|
| Algorithm | HNSW approximate nearest neighbor search over embeddings | BM25 ranking over an inverted index |
| Semantic understanding | Yes, meaning-based retrieval | No, keyword-based retrieval |
| Bundle size (gzip) | 54KB WebAssembly | About 13KB minified and gzipped |
| Runtime index build | No, index is pre-built offline | Yes, build from JavaScript objects in the app |
| Fuzzy search | No native typo matcher, semantic similarity can still rescue related phrasing | Yes, built-in fuzzy search support |
| BM25 ranking | No | Yes |
| Works offline | Yes | Yes |
| Build step required | Yes, embeddings and index serialization | No |
| License | MIT | MIT |
MiniSearch mindset
You import a small library, pass in fields, build the index in memory, and search plain text directly. Relevance comes from BM25 scoring, field boosts, fuzzy tolerance, and how closely user terms overlap with stored terms.
altor-vec mindset
You prepare embeddings ahead of time, ship a static binary index, and query by vector similarity. Relevance comes from semantic closeness, so users can search with different wording than the document itself uses.
Why teams switch
Teams usually move away from keyword-only search when failed searches are caused by intent mismatch, not typos. If users say undo changes and your docs say revert commit, semantic recall matters more than another round of BM25 tuning.
Code comparison
altor-vec
import init, { WasmSearchEngine } from 'altor-vec';
await init();
const response = await fetch('/search-index.bin');
const engine = WasmSearchEngine.from_bytes(
new Uint8Array(await response.arrayBuffer())
);
// queryEmbedding is generated from the user's query text
// Can match "cancel subscription" to "end your plan"
const hits = JSON.parse(engine.search(queryEmbedding, 5));
MiniSearch
import MiniSearch from 'minisearch';
const miniSearch = new MiniSearch({ fields: ['title', 'content'], storeFields: ['title', 'url'] });
miniSearch.addAll(docs);
// Returns results ranked by BM25, keyword frequency matters
// Will NOT find "end your plan" when searching "cancel subscription"
const results = miniSearch.search('cancel subscription', { fuzzy: 0.2 });
The implementation difference here is architectural, not cosmetic. MiniSearch searches text terms directly, scores them with BM25, and can be added to a client app with almost no pipeline work. altor-vec pushes more work to build time, because embeddings must exist before the browser can perform HNSW lookup. In return, search quality is less dependent on exact phrasing and more resilient to synonym and paraphrase gaps.
When to choose each
Choose MiniSearch when:
- You want zero build step and need a library that works immediately on plain JavaScript objects.
- Your search problem is mostly keyword retrieval, typo tolerance, prefix matching, and field boosting.
- Bundle size matters a lot, and 13KB is easier to justify than a 54KB WASM asset.
- Your docs, products, or content already use the same language your users type into search.
Choose altor-vec when:
- Your users search by intent, paraphrase, and related concepts rather than exact terminology.
- You want better recall on documentation and support content where authors and users use different words.
- You expect corpus growth and want sub-millisecond query performance at around 10K vectors with HNSW scaling.
- You can support a build-time embedding pipeline and pre-built index asset.
Neither tool wins universally. MiniSearch is often the better engineering trade when the corpus is small to medium, the query language is predictable, and shipping fast matters more than maximum recall. altor-vec earns its complexity when missed results come from vocabulary mismatch, because semantic retrieval directly targets that failure mode instead of adding more keyword heuristics.
Migration from MiniSearch
- Audit your failure cases. Confirm that users are missing relevant results because of wording mismatch, not because of ranking weights, missing fields, or poor content structure.
- Add an embedding pipeline. Generate embeddings for each searchable document during build or deploy, then serialize the altor-vec HNSW index to a static binary file.
- Swap runtime search calls. Replace
miniSearch.search(query)with a flow that converts the query into an embedding and callsengine.search(queryEmbedding, k). - Keep your existing UI. Result components, keyboard navigation, highlighting, and analytics can stay largely unchanged while the retrieval layer changes underneath.
- Measure relevance, not novelty. Compare successful search rate, result clicks, and reformulation behavior before fully replacing BM25 with vector search.
FAQ
Is altor-vec a replacement for MiniSearch?
Not always. MiniSearch is an excellent choice for full-text keyword search with BM25 ranking, fuzzy matching, and zero build pipeline. altor-vec is the better fit when semantic understanding matters more than keyword frequency, when users search cancel subscription and the document says end your plan, altor-vec finds it; MiniSearch does not.
How does MiniSearch compare to altor-vec in bundle size?
MiniSearch is approximately 13KB minified and gzipped. altor-vec ships as a 54KB gzipped WebAssembly bundle. The size difference exists because altor-vec includes a compiled Rust HNSW implementation in WASM. For keyword search, MiniSearch is the more efficient choice. For semantic search, altor-vec's size is justified.
Does MiniSearch support semantic search?
No. MiniSearch uses BM25 ranking over an inverted index, which is a keyword-based algorithm. It can do fuzzy matching and prefix search, but it cannot understand that pricing and cost are related concepts. Semantic search requires a vector embedding model and a nearest-neighbor index like altor-vec's HNSW implementation.
Do I need a build step for MiniSearch unlike altor-vec?
MiniSearch builds its index at runtime from plain JavaScript objects, no build step required. altor-vec requires a build-time step to generate vector embeddings for your documents and serialize the HNSW index to a binary file. That build step is the price of semantic search; MiniSearch avoids it entirely by using BM25 over raw text.
Which is better for a documentation site: altor-vec or MiniSearch?
It depends on your documentation's vocabulary gap. If your docs use the same terms your users search for, MiniSearch with BM25 works well and is far simpler to integrate. If users frequently search with different words than your docs use, for example searching how to undo when the docs say revert changes, altor-vec's semantic search provides meaningfully better recall.
Bottom line
MiniSearch is one of the best lightweight keyword search libraries in JavaScript, and it deserves that reputation. altor-vec is a better MiniSearch alternative only when you need semantic understanding, better recall on intent-heavy queries, and stronger scaling as corpora grow. If your users already search with the same words your content uses, stick with MiniSearch. If they routinely describe the same idea with different language, altor-vec is the more capable retrieval engine.
related resources