Skip to main content

VectorExtension

Trait VectorExtension 

Source
pub trait VectorExtension {
    // Required methods
    fn load_vector_extension(&self, path: Option<&Path>) -> Result<()>;
    fn vector_init(
        &self,
        table: &str,
        column: &str,
        config: VectorConfig,
    ) -> Result<()>;
    fn has_vector_support(&self) -> bool;
    fn vector_version(&self) -> Result<String>;
}
Expand description

Extend SqliteProjectionStore with vector support

Required Methods§

Source

fn load_vector_extension(&self, path: Option<&Path>) -> Result<()>

Load the sqlite-vector extension

§Example
use azoth::prelude::*;
use azoth_vector::VectorExtension;

let db = AzothDb::open("./data")?;
db.projection().load_vector_extension(None)?;
Source

fn vector_init( &self, table: &str, column: &str, config: VectorConfig, ) -> Result<()>

Initialize a vector column

Must be called after creating the table with a BLOB column.

§Example
use azoth::prelude::*;
use azoth_vector::{VectorExtension, VectorConfig};

// Create table with BLOB column
// Initialize vector column
Source

fn has_vector_support(&self) -> bool

Check if vector extension is loaded

§Example
use azoth::prelude::*;
use azoth_vector::VectorExtension;

let db = AzothDb::open("./data")?;
if !db.projection().has_vector_support() {
    db.projection().load_vector_extension(None)?;
}
Source

fn vector_version(&self) -> Result<String>

Get the version of the sqlite-vector extension

Implementations on Foreign Types§

Source§

impl VectorExtension for SqliteProjectionStore

Source§

fn load_vector_extension(&self, path: Option<&Path>) -> Result<()>

Source§

fn vector_init( &self, table: &str, column: &str, config: VectorConfig, ) -> Result<()>

Source§

fn has_vector_support(&self) -> bool

Source§

fn vector_version(&self) -> Result<String>

Implementors§