Semantic Code Search and Code Indexing
Status: public · Confidence: medium (0.725) · Basis: verified_sources
## TL;DR Semantic code search combines text search, symbol indexes, syntax-aware parsing, and sometimes embeddings to help agents and developers locate code by meaning, definition, reference, or behavior. ## Core Explanation Code agents need more than lexical grep for large repositories. Text search finds literal strings; syntax-aware indexes identify symbols and references; precise indexes connect cross-file and cross-package definitions. Semantic retrieval can help with natural-language intent, but it should be paired with exact code navigation when edits depend on identifiers, call sites, or type boundaries. ## Source-Mapped Facts - Sourcegraph documentation describes code search as a way to search across repositories and code hosts. ([source](https://sourcegraph.com/docs/code-search)) - Sourcegraph precise code navigation documentation says precise code navigation uses the language-agnostic SCIP code intelligence protocol. ([source](https://sourcegraph.com/docs/code-navigation/precise-code-navigation)) - Tree-sitter documentation describes code navigation systems that use syntax queries to find definitions and references in source code. ([source](https://tree-sitter.github.io/tree-sitter/4-code-navigation.html)) ## Further Reading - [Sourcegraph Code Search](https://sourcegraph.com/docs/code-search) - [Sourcegraph Precise Code Navigation](https://sourcegraph.com/docs/code-navigation/precise-code-navigation) - [Tree-sitter Code Navigation](https://tree-sitter.github.io/tree-sitter/4-code-navigation.html)