Skip to main content

tinyquant_pgvector/
lib.rs

1//! pgvector-backed search backend for `TinyQuant`.
2//!
3//! Provides [`PgvectorAdapter`], an implementation of [`SearchBackend`] that
4//! stores and queries vectors in a `PostgreSQL` database with the `pgvector`
5//! extension installed.
6//!
7//! # Integration tests
8//!
9//! Tests that require a live `PostgreSQL` server are gated behind the
10//! `test-containers` feature flag.  They are not run by the default
11//! `cargo test` invocation.
12#![deny(
13    warnings,
14    missing_docs,
15    unsafe_op_in_unsafe_fn,
16    clippy::all,
17    clippy::pedantic,
18    clippy::nursery,
19    clippy::unwrap_used,
20    clippy::expect_used,
21    clippy::panic,
22    clippy::indexing_slicing,
23    clippy::cognitive_complexity
24)]
25#![allow(
26    clippy::module_name_repetitions,
27    clippy::must_use_candidate,
28    // `return` in `#[cfg(not(feature = "live-db"))]` blocks is "needless"
29    // when building without the feature (since the cfg block IS the last
30    // expression). Suppress globally for this crate; the pattern is
31    // intentional and readable.
32    clippy::needless_return
33)]
34
35pub(crate) mod adapter;
36pub(crate) mod errors;
37pub(crate) mod sql;
38pub(crate) mod wire;
39
40pub use adapter::PgvectorAdapter;
41pub use errors::BackendError;
42pub use tinyquant_core::backend::{SearchBackend, SearchResult};