1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Semantic retrieval layer for normalize.
//!
//! This crate provides vector embeddings over structurally-derived chunks
//! (symbols + doc comments + caller/callee context + co-change neighbors),
//! stored in SQLite alongside the structural index, queryable by meaning
//! rather than by name.
//!
//! ## Architecture
//!
//! - **[`config`]** -- `EmbeddingsConfig` (`[embeddings]` section of config.toml)
//! - **[`chunks`]** -- context window construction from index rows
//! - **[`embedder`]** -- fastembed wrapper (ONNX, no server required)
//! - **[`schema`]** -- SQLite DDL for the `embeddings` table
//! - **[`store`]** -- read/write embeddings to/from SQLite
//! - **[`search`]** -- ANN search + staleness re-ranking
//! - **[`populate`]** -- walk the structural index and embed symbols, docs, and commits
//! - **[`service`]** -- CLI service (`normalize structure search`) -- `cli` feature
//!
//! ## Usage
//!
//! After `structure rebuild`, call [`populate::populate_embeddings`] with the
//! active `FileIndex` connection to generate and store embeddings.
//!
//! For markdown and commit embeddings, call [`populate::populate_markdown_docs`]
//! and [`populate::populate_commit_messages`] respectively.
//! For `.normalize/context/` block embeddings, call [`populate::populate_context_blocks`].
//!
//! To search, call [`service::run_search`] (all source types) or
//! [`service::run_context_search`] (context blocks only), or use
//! [`store::load_all_embeddings`] + [`search::rerank`] directly.
// Re-export the key public types for convenience.
pub use EmbeddingsConfig;
pub use ;
pub use SearchHit;
use Connection;
use FileIndex;
/// Open the index and return a reference to its SQLite connection.
/// Convenience helper used by populate and service modules.
pub async
/// Ensure the embeddings schema exists in the given connection.
/// Safe to call multiple times (all DDL uses `IF NOT EXISTS`).
pub async