Skip to main content

Crate recern_vector

Crate recern_vector 

Source
Expand description

Recern Vector — a single-file, embedded, inspectable vector database.

A snapshot and a WAL hold any number of collections. Each collection stores vectors of a fixed dimension, optional JSON metadata, and an HNSW index whose internals can be inspected through Collection::stats, Collection::explain and Collection::estimate_recall.

use recern_vector::{CollectionConfig, Database, Metric, SearchOptions};

let mut db = Database::open_or_create("docs.rvec")?;
let docs = db.create_collection("docs", CollectionConfig::new(3, Metric::Cosine))?;
docs.upsert("a", &[0.1, 0.9, 0.0], None)?;
docs.upsert("b", &[0.8, 0.1, 0.1], None)?;
let hits = docs.search(&[0.2, 0.8, 0.0], 1, &SearchOptions::default())?;
assert_eq!(hits[0].id, "a");
db.save()?;

Structs§

Collection
CollectionConfig
CollectionStats
Database
An in-memory database backed by a snapshot and a checksummed .wal journal. Mutations become durable at save(). Use checkpoint() before copying a standalone file. Concurrent handles can read; stale writers fail on save.
HnswParams
HNSW index parameters.
RecallOptions
RecallPoint
RecallReport
Record
A stored record. For cosine collections vector is the normalized vector.
RecordPage
A bounded page in physical insertion order. Cursors are valid only while the collection is unchanged; take a read-only snapshot for an export.
SearchHit
SearchOptions
SearchReport
Search results together with the work it took to produce them.

Enums§

Error
Filter
Metadata predicate applied during search.
Metric
Distance function of a collection. For every metric, smaller is closer.
Quantization
Storage precision. Int8 uses a symmetric scale per vector; original floats are not retained. Exact searches are exact over the stored approximation.
Strategy
How a query was answered.

Constants§

FORMAT_VERSION

Type Aliases§

Result