General
What is VectoriaDB?
What is VectoriaDB?
VectoriaDB is a lightweight in-memory vector database for semantic search. It uses transformers.js to generate embeddings locally, so your data never leaves the server. It’s designed for tool discovery, document search, and recommendation systems.
When should I use VectoriaDB?
When should I use VectoriaDB?
Use VectoriaDB when you need:
- Semantic search over tools, documents, or prompts
- Offline operation without external API dependencies
- Privacy-first applications where data can’t leave the server
- Type-safe metadata with TypeScript generics
What's the difference between VectoriaDB and TFIDFVectoria?
What's the difference between VectoriaDB and TFIDFVectoria?
| Feature | VectoriaDB | TFIDFVectoria |
|---|---|---|
| Understanding | Semantic (understands meaning) | Keyword-based (exact matches) |
| Dependencies | transformers.js (~22MB model) | Zero dependencies |
| Initialization | Async (model download) | Synchronous |
| Reindex required | No | Yes, after changes |
Is VectoriaDB production-ready?
Is VectoriaDB production-ready?
Yes. VectoriaDB includes production-ready features:
- Operational guardrails: Rate limits, batch validation, document size limits
- Persistence: File and Redis storage adapters
- Error handling: Typed error classes with machine-readable codes
- HNSW indexing: Sub-millisecond queries at scale
Performance
How many documents can VectoriaDB handle?
How many documents can VectoriaDB handle?
VectoriaDB can handle 100,000+ documents efficiently:
- Brute-force search: Good for < 10,000 documents
- HNSW indexing: Required for > 10,000 documents, supports 100,000+
How fast is search?
How fast is search?
Search performance depends on your configuration:
Enable HNSW for sub-millisecond queries on large datasets.
| Documents | Brute-force | HNSW (ef=50) |
|---|---|---|
| 10,000 | ~50ms | ~1ms |
| 50,000 | ~250ms | ~1ms |
| 100,000 | ~500ms | ~2ms |
Why is the first query slow?
Why is the first query slow?
The first query after initialization may be slower because:
- Model warmup: The first embedding generation warms up the model
- JIT compilation: JavaScript engines optimize hot code paths
How much memory does VectoriaDB use?
How much memory does VectoriaDB use?
Memory usage depends on:
- Embeddings: ~1.5KB per document (384 dimensions x 4 bytes)
- Metadata: Variable based on your metadata size
- HNSW index: ~50-100 bytes per document for graph connections
Configuration
Can I use a different embedding model?
Can I use a different embedding model?
Yes. VectoriaDB supports any transformers.js-compatible model:The default
src/custom-model.ts
Xenova/all-MiniLM-L6-v2 provides good quality with fast inference.How do I enable HNSW?
How do I enable HNSW?
How do I persist embeddings?
How do I persist embeddings?
Use a storage adapter to persist embeddings between restarts:See Storage guide for details.
src/persistence.ts
What's the default similarity threshold?
What's the default similarity threshold?
The default threshold is
0.3. Adjust based on your use case:- 0.3-0.4: Loose matching, more results
- 0.5-0.6: Moderate matching, balanced
- 0.7+: Strict matching, high precision
Troubleshooting
Why am I getting VectoriaNotInitializedError?
Why am I getting VectoriaNotInitializedError?
You must call
initialize() before any operation:src/fix-not-initialized.ts
initialize() is idempotent - calling it multiple times is safe.Why are my search results empty?
Why are my search results empty?
Common causes:
- Threshold too high: Lower the
thresholdoption - No matching documents: Check that documents are indexed
- Filter too restrictive: Review your
filterfunction
src/debug-search.ts
Model download fails - what should I do?
Model download fails - what should I do?
If model download fails:
- Check network: Ensure internet access to Hugging Face
- Check permissions: Ensure write access to
cacheDir - Use a proxy: Set
HTTPS_PROXYenvironment variable - Pre-download: Download the model manually
How do I debug poor search quality?
How do I debug poor search quality?
To improve search quality:
- Check document text: Ensure text is descriptive
- Adjust threshold: Try different values
- Inspect scores: Look at
result.scorevalues - Review embeddings: Use
includeVector: trueto inspect
src/debug-quality.ts
Related
Common Errors
Error reference and solutions
Error Handling
Programmatic error handling