Skip to main content

codelens_engine/
embedding_store.rs

1//! Data types for vector embedding storage.
2//!
3//! The `EmbeddingStore` trait was removed in v1.12 — `SqliteVecStore` is the
4//! single implementation, used directly inside `embedding/mod.rs`. Only the
5//! plain data structs remain here so callers can still construct chunks and
6//! consume search results.
7
8use serde::Serialize;
9
10/// A single embedding chunk ready for storage.
11#[derive(Debug, Clone)]
12pub struct EmbeddingChunk {
13    pub file_path: String,
14    pub symbol_name: String,
15    pub kind: String,
16    pub line: usize,
17    pub signature: String,
18    pub name_path: String,
19    pub text: String,
20    /// Primary embedding: code signature + identifier split
21    pub embedding: Vec<f32>,
22    /// Optional secondary embedding: docstring/comment (for dual-vector search)
23    pub doc_embedding: Option<Vec<f32>>,
24}
25
26/// Result of a vector similarity search.
27#[derive(Debug, Clone, Serialize)]
28pub struct ScoredChunk {
29    pub file_path: String,
30    pub symbol_name: String,
31    pub kind: String,
32    pub line: usize,
33    pub signature: String,
34    pub name_path: String,
35    pub score: f64,
36}