Back to Gitlabhq

Semantic code search

doc/user/gitlab_duo/semantic_code_search.md

19.2.02.5 KB
Original Source

{{< details >}}

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

{{< /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.

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.