Semantic code search

  • Tier: Premium, Ultimate
  • Add-on: GitLab Duo Core, Pro, or Enterprise
  • Offering: GitLab.com, GitLab Self-Managed
  • Status: Beta

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.

Prerequisites

Semantic code search is available through multiple interfaces:

Ad-hoc initial indexing

When you first use semantic code search in a GitLab project:

  • Your repository code is indexed and converted into vector embeddings.
  • These embeddings are stored in your configured vector store.
  • Updates are processed incrementally when code is pushed to the default branch.

Initial indexing can take time for large repositories.

On GitLab.com, you can trigger ad-hoc indexing only if you are a member of the project, or of its top-level group or any of its subgroups, or if you have access through a shared group or project. If you do not have this access, semantic code search returns a message that the project is not indexed.