Semantic search finds code and documents by meaning. Instead of matching exact text, it understands what you’re looking for and returns relevant results even when terminology differs.
Search documentation comments on symbols using natural language.
JavaScript/TypeScript
Python
Rust
class AuthService { /** * Authenticate user with email and password. * Returns JWT token on success. */ static default(config) { ... }}
class AuthService: def __call__(self, email: str, password: str) -> str: """ Authenticate user with email and password. Returns JWT token on success. """ ...
impl AuthService { /// Authenticate user with email and password. /// Returns JWT token on success. pub fn new(email: &str, password: &str) -> Self { ... }}
Symbol names don’t always describe their purpose - new(), Default, impl, or abbreviated names like above. Semantic search finds them through their documentation, not the name.
Found 3 semantically similar result(s) for 'user authentication':1. name (Field) - Similarity: 0.356 File: src/plugins/marketplace.rs:40 Doc: Owner name (user or organization)2. name (Field) - Similarity: 0.356 File: src/profiles/provider.rs:40 Doc: Owner name (user or organization)3. credential_callback (Function) - Similarity: 0.332 File: src/profiles/git.rs:80 Doc: Credential callback for git2 authentication
Search markdown and text files indexed in collections.
# Add and index a collectioncodanna documents add-collection docs docs/codanna documents index# Searchcodanna documents search "authentication flow"# Or via MCPcodanna mcp search_documents query:"setup guide" limit:5
Use an OpenAI-compatible HTTP embedding server instead of the local fastembed model. Supports OpenAI, Ollama, vLLM, Infinity, and any server implementing POST /v1/embeddings.
export CODANNA_EMBED_URL=http://localhost:11434 # Server base URLexport CODANNA_EMBED_MODEL=nomic-embed-text # Model nameexport CODANNA_EMBED_DIM=768 # Output dimension
For servers requiring authentication (OpenAI, cloud providers):
export CODANNA_EMBED_API_KEY=sk-...
Or configure in settings.toml (except the API key, which is env-var only):
When you change embedding backends, the stored index dimension may not match the new backend. Codanna detects this and disables semantic search with an error:
ERROR: semantic search disabled -- index incompatible:Index was built with 384-dimensional embeddings but current backend produces 768d.Re-index with: codanna index <path> --force
Re-index with --force to rebuild with the new backend: