Fast trigram based code search

Clone this repo:


  1. b74f98e doc: add a note about branches in the FAQ. by Han-Wen Nienhuys · 3 days ago master
  2. ddb972a shards: load up to NumCPU() shards in parallel by Han-Wen Nienhuys · 3 days ago
  3. 5e0e28f shards: use x/sync/semaphore for throttling by Han-Wen Nienhuys · 3 days ago
  4. c2a8543 Revert "shards: load up to NumCPU() shards in parallel" by hanwen · 4 days ago
  5. 3561dc9 shards: load up to NumCPU() shards in parallel by Han-Wen Nienhuys · 7 days ago
"Zoekt, en gij zult spinazie eten" - Jan Eertink

("seek, and ye shall eat spinach" - My primary school teacher)

This is a fast text search engine, intended for use with source code. (Pronunciation: roughly as you would pronounce “zooked” in English)



go get


go install
$GOPATH/bin/zoekt-index .


go install
$GOPATH/bin/zoekt 'ngram f:READ'

Indexing git repositories:

go install
$GOPATH/bin/zoekt-git-index -branches master,stable-1.4 -prefix origin/ .

Indexing repo repositories:

go install{repo-index,mirror-gitiles}
zoekt-mirror-gitiles -dest ~/repos/
zoekt-repo-index \
   -name gfiber \
   -base_url \
   -manifest_repo ~/repos/ \
   -repo_cache ~/repos \
   -manifest_rev_prefix=refs/heads/ --rev_prefix= \

Starting the web interface

go install
$GOPATH/bin/zoekt-webserver -listen :6070

A more organized installation on a Linux server should use a systemd unit file, eg.

Description=zoekt webserver

ExecStart=/zoekt/bin/zoekt-webserver -index /zoekt/index -listen :443  --ssl_cert /zoekt/etc/cert.pem   --ssl_key /zoekt/etc/key.pem



Zoekt comes with a small service management program:

go install

cat << EOF > config.json
[{"GithubUser": "username"},
 {"GitilesURL": "", Name: "zoekt" }

$GOPATH/bin/zoekt-server -mirror_config config.json

This will mirror all repos under ‘’ as well as the ‘zoekt’ repository. It will index the repositories.

It takes care of fetching and indexing new data and cleaning up logfiles.

The webserver can be started from a standard service management framework, such as systemd.


It is recommended to install Universal ctags to improve ranking, in particular, version db3d9a6 or newer, which supports seccomp sandboxing.


Thanks to Alexander Neubeck for coming up with this idea, and helping me flesh it out.


This is not an official Google product