# Zoekt

> Fast trigram-based code search engine for source code, supporting substring and regexp matching with a rich query language across single or many repositories.

Zoekt is an open-source text search engine written in Go, designed specifically for searching source code at scale. Originally created by Han-Wen Nienhuys at Google, it has been maintained by Sourcegraph since 2017 when it was forked from the original `github.com/google/zoekt` repository. It is licensed under Apache 2.0 and actively developed on GitHub.

## What It Is

Zoekt (pronounced roughly like "zooked") is a trigram-indexed code search engine that supports fast substring and regular expression matching across source code repositories. It features a rich query language with boolean operators (and, or, not), can search individual repositories or large multi-repository codebases, and ranks results using code-aware signals such as whether a match falls on a symbol. Its general design based on trigram indexing and syntactic parsing makes it effective across a wide variety of programming languages.

## Core Architecture

Zoekt's search performance is built on trigram indexing — breaking text into overlapping three-character sequences to enable rapid candidate filtering before full match evaluation. Key architectural components include:

- **zoekt-git-index**: indexes local Git repositories
- **zoekt-local-sync**: recursively discovers and synchronizes Git repositories under one or more root directories
- **zoekt-indexserver**: a long-running service that mirrors and periodically re-indexes repositories from remote code hosts (e.g., GitHub organizations)
- **zoekt-webserver**: serves a web UI and API for search, including a JSON API and a gRPC API with structured query objects and streaming results
- **Universal ctags integration**: symbol information from ctags is used as a key ranking signal

## Deployment Model

Zoekt supports two primary usage modes. The first is command-line usage for local indexing and searching, suitable for development and testing. The second is a server-based deployment using the indexserver and webserver pair, which handles large-scale, continuously updated codebases. A container image is published at `ghcr.io/sourcegraph/zoekt` that bundles the Zoekt binaries, `git`, and `universal-ctags`, making containerized deployment straightforward with Docker.

The webserver exposes:
- A simple web search UI at `http://localhost:6070`
- A JSON search API (with BM25 scoring and context lines support)
- A gRPC API supporting structured queries and streaming results

## Query Language and Search Capabilities

Zoekt's query language supports a range of search patterns beyond simple text matching:

- Substring and regular expression search
- Boolean operators: `and`, `or`, `not`
- File path filtering (e.g., `file:README`)
- Symbol-aware ranking via ctags integration
- Alternative BM25 scoring mode
- Context lines around matches

Full query syntax is documented in the project's `doc/query_syntax.md`.

## Current Status

The repository shows active maintenance, with the last push recorded in late July 2026 and ongoing open issues. The project has accumulated over 1,800 GitHub stars and more than 228 forks, reflecting its role as a foundational component in Sourcegraph's broader code intelligence platform. It remains the canonical maintained fork of the original Google Zoekt project.

## Features
- Trigram-based indexing for fast code search
- Substring and regular expression matching
- Boolean query operators (and, or, not)
- File path filtering in queries
- Symbol-aware result ranking via Universal ctags
- Multi-repository search across large codebases
- Index server with periodic re-indexing from code hosts
- Web UI for search
- JSON search API with BM25 scoring and context lines
- gRPC API with structured queries and streaming results
- GitHub organization mirroring
- Docker container image
- Local Git repository indexing
- zoekt-local-sync for recursive repository discovery

## Integrations
Git, GitHub, Universal ctags, Docker, gRPC

## Platforms
CLI, API, WEB

## Pricing
Open Source

## Version
main

## Links
- Website: https://github.com/sourcegraph/zoekt
- Documentation: https://github.com/sourcegraph/zoekt/tree/main/doc
- Repository: https://github.com/sourcegraph/zoekt
- EveryDev.ai: https://www.everydev.ai/tools/zoekt
