Add comprehensive documentation with i18n support (EN/BG)
- Add docs/ folder with English (en/) and Bulgarian (bg/) documentation - Create index.md with language switching and links - English docs: installation, quickstart, architecture, baraql, storage, schema, lsm, btree, vector, graph, fts, columnar, transactions, distributed, protocol, udf, api-binary, api-http, api-websocket - Bulgarian docs: installation, quickstart, architecture, baraql, schema, lsm, btree, vector, graph, fts, transactions, distributed - Update README license to BSD 3-Clause - Add LICENSE file with BSD 3-Clause text
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
# Vector Search Engine
|
||||
|
||||
Native HNSW and IVF-PQ indexes for similarity search.
|
||||
|
||||
## Usage
|
||||
|
||||
```nim
|
||||
import barabadb/vector/engine
|
||||
|
||||
var idx = newHNSWIndex(dimensions = 128)
|
||||
idx.insert(1, @[1.0'f32, 0.0'f32, ...], {"category": "A"}.toTable)
|
||||
|
||||
# Search
|
||||
let results = idx.search(queryVector, k = 10)
|
||||
|
||||
# With metadata filtering
|
||||
let filtered = idx.searchWithFilter(queryVector, k = 10,
|
||||
filter = proc(meta: Table[string, string]): bool =
|
||||
return meta.getOrDefault("category") == "A")
|
||||
```
|
||||
|
||||
## Index Types
|
||||
|
||||
### HNSW
|
||||
|
||||
Hierarchical Navigable Small World graph for approximate nearest neighbor search.
|
||||
|
||||
```nim
|
||||
var hnsw = newHNSWIndex(
|
||||
dimensions = 128,
|
||||
m = 16, # connections per layer
|
||||
efConstruction = 200, # search width during construction
|
||||
efSearch = 100 # search width during query
|
||||
)
|
||||
```
|
||||
|
||||
### IVF-PQ
|
||||
|
||||
Inverted File Index with Product Quantization for compression.
|
||||
|
||||
```nim
|
||||
var ivfpq = newIVFPQIndex(
|
||||
dimensions = 128,
|
||||
numCentroids = 256,
|
||||
subQuantizers = 8
|
||||
)
|
||||
```
|
||||
|
||||
## Distance Metrics
|
||||
|
||||
| Metric | Description |
|
||||
|--------|-------------|
|
||||
| `cosine` | Cosine similarity |
|
||||
| `euclidean` | L2 distance |
|
||||
| `dotproduct` | Dot product similarity |
|
||||
| `manhattan` | L1 distance |
|
||||
|
||||
## Quantization
|
||||
|
||||
```nim
|
||||
import barabadb/vector/quant
|
||||
|
||||
# Scalar quantization
|
||||
let scalar = scalarQuantize(data, bits = 8)
|
||||
|
||||
# Product quantization
|
||||
let pq = productQuantize(data, subVectors = 8, bits = 8)
|
||||
```
|
||||
|
||||
## SIMD Acceleration
|
||||
|
||||
```nim
|
||||
import barabadb/vector/simd
|
||||
|
||||
let dist = simdCosineDistance(vec1, vec2)
|
||||
```
|
||||
Reference in New Issue
Block a user