pub mod lance_client;
pub use lance_client::LanceVectorDB;
#[cfg(feature = "qdrant-backend")]
pub mod qdrant_client;
#[cfg(feature = "qdrant-backend")]
pub use qdrant_client::QdrantVectorDB;
use crate::types::{ChunkMetadata, SearchResult};
use anyhow::Result;
#[async_trait::async_trait]
pub trait VectorDatabase: Send + Sync {
async fn initialize(&self, dimension: usize) -> Result<()>;
async fn store_embeddings(
&self,
embeddings: Vec<Vec<f32>>,
metadata: Vec<ChunkMetadata>,
contents: Vec<String>,
root_path: &str,
) -> Result<usize>;
#[allow(clippy::too_many_arguments)]
async fn search(
&self,
query_vector: Vec<f32>,
query_text: &str,
limit: usize,
min_score: f32,
project: Option<String>,
root_path: Option<String>,
hybrid: bool,
) -> Result<Vec<SearchResult>>;
#[allow(clippy::too_many_arguments)]
async fn search_filtered(
&self,
query_vector: Vec<f32>,
query_text: &str,
limit: usize,
min_score: f32,
project: Option<String>,
root_path: Option<String>,
hybrid: bool,
file_extensions: Vec<String>,
languages: Vec<String>,
path_patterns: Vec<String>,
) -> Result<Vec<SearchResult>>;
async fn delete_by_file(&self, file_path: &str) -> Result<usize>;
async fn clear(&self) -> Result<()>;
async fn get_statistics(&self) -> Result<DatabaseStats>;
async fn flush(&self) -> Result<()>;
async fn count_by_root_path(&self, root_path: &str) -> Result<usize>;
async fn get_indexed_files(&self, root_path: &str) -> Result<Vec<String>>;
}
#[derive(Debug, Clone)]
pub struct DatabaseStats {
pub total_points: usize,
pub total_vectors: usize,
pub language_breakdown: Vec<(String, usize)>,
}