Skip to main content

Crate recern_vector

Crate recern_vector 

Source
Expand description

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

A database is one file holding 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
A database file and the collections it holds.
HnswParams
HNSW index parameters.
RecallOptions
RecallPoint
RecallReport
Record
A stored record. For cosine collections vector is the normalized vector.
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.
Strategy
How a query was answered.

Constants§

FORMAT_VERSION

Type Aliases§

Result