doc/user/gitlab_duo/semantic_code_search.md
{{< details >}}
{{< /details >}}
{{< history >}}
{{< /history >}}
[!note] For administrator documentation, see semantic code search administration.
Use semantic code search to find relevant code snippets in your repository based on meaning rather than keyword matching.
Semantic code search converts your codebase into vector embeddings stored in a vector database. When you search, your query is converted into an embedding and compared against your code embeddings to find semantically similar results. This approach finds relevant code even when keywords do not match.
Semantic code search is available through multiple interfaces:
GET /api/v4/projects/:id/search/semantic endpoint to search your codebase programmatically.semantic_code_search tool in agentic workflows.glab search semantic command for command-line access.When you first use semantic code search in a GitLab project:
Initial indexing can take time for large repositories.