codanna/semantic/mod.rs
1//! Semantic search functionality for documentation comments
2//!
3//! This module provides a simple API for semantic search on documentation,
4//! designed to integrate with the existing indexing system.
5
6mod metadata;
7mod pool;
8pub(crate) mod remote;
9mod simple;
10mod storage;
11
12pub use metadata::{EmbeddingBackendKind, SemanticMetadata};
13pub use pool::{EmbeddingBackend, EmbeddingPool};
14pub use remote::RemoteEmbedder;
15pub use simple::{SemanticSearchError, SimpleSemanticSearch};
16pub use storage::SemanticVectorStorage;
17
18// Re-export key types
19pub use fastembed::{EmbeddingModel, TextEmbedding};
20
21/// Similarity threshold recommendations based on testing
22pub mod thresholds {
23 /// Threshold for very similar documents (e.g., same concept, different wording)
24 pub const VERY_SIMILAR: f32 = 0.75;
25
26 /// Threshold for similar documents (e.g., related concepts)
27 pub const SIMILAR: f32 = 0.60;
28
29 /// Threshold for somewhat related documents
30 pub const RELATED: f32 = 0.40;
31
32 /// Default threshold for semantic search
33 pub const DEFAULT: f32 = SIMILAR;
34}