| Crates.io | oak-semantic-search |
| lib.rs | oak-semantic-search |
| version | 0.0.1 |
| created_at | 2026-01-23 02:50:29.637015+00 |
| updated_at | 2026-01-23 02:50:29.637015+00 |
| description | Fuzzy semantic search and code indexing for the Oak framework. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 2063249 |
| size | 29,234 |
Advanced AI-powered semantic search for source code, leveraging AST-aware chunking and vector embeddings.
Oak Semantic Search goes beyond traditional keyword search by understanding the structure and meaning of your code. It uses oak-core to intelligently chunk source code into meaningful units (like functions, classes, and documentation) and indexes them using state-of-the-art embedding models and vector databases.
fastembed to generate high-quality vector representations of code.vectordb (LanceDB) for efficient similarity search.Basic usage of the SemanticSearcher:
use oak_semantic_search::SemanticSearcher;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let searcher = SemanticSearcher::new("./my_vector_db").await?;
// Indexing code is handled via the index_code method
// searcher.index_code::<MyLanguage>(&root, source, "my_project_table").await?;
// Search using natural language
let results = searcher.search("how to handle user authentication", 5).await?;
for result in results {
println!("Found: {}", result);
}
Ok(())
}
The library uses a ChunkCollector to extract meaningful pieces of code:
// Internally, it identifies nodes with roles like:
// - UniversalElementRole::Definition
// - UniversalElementRole::Statement
// - UniversalElementRole::Documentation
Oak Semantic Search leverages fastembed, allowing you to choose from various pre-trained models optimized for code or general text.
The library implements the SemanticSearch trait, making it compatible with the Model Context Protocol (MCP) for AI agent integration.
Contributions are welcome! Please feel free to submit issues or pull requests.
Oak Semantic Search - Understanding the meaning behind the code 🚀