cmd

package module
v0.0.0-...-0464db2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

README

"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)

INSTRUCTIONS

Downloading:

go get github.com/sniperkit/snk.fork.zoekt

Indexing:

go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-index
$GOPATH/bin/zoekt-index .

Searching

go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt
$GOPATH/bin/zoekt 'ngram f:READ'

Indexing git repositories:

go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-git-index
$GOPATH/bin/zoekt-git-index -branches master,stable-1.4 -prefix origin/ .

Indexing repo repositories:

go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-{repo-index,mirror-gitiles}
zoekt-mirror-gitiles -dest ~/repos/ https://gfiber.googlesource.com
zoekt-repo-index \
   -name gfiber \
   -base_url https://gfiber.googlesource.com/ \
   -manifest_repo ~/repos/gfiber.googlesource.com/manifests.git \
   -repo_cache ~/repos \
   -manifest_rev_prefix=refs/heads/ --rev_prefix= \
   master:default_unrestricted.xml

Starting the web interface

go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-webserver
$GOPATH/bin/zoekt-webserver -listen :6070

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

[Unit]
Description=zoekt webserver

[Service]
ExecStart=/zoekt/bin/zoekt-webserver -index /zoekt/index -listen :443  --ssl_cert /zoekt/etc/cert.pem   --ssl_key /zoekt/etc/key.pem
Restart=always

[Install]
WantedBy=default.target

SEARCH SERVICE

Zoekt comes with a small service management program:

go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-indexserver

cat << EOF > config.json
[{"GithubUser": "username"},
 {"GitilesURL": "https://gerrit.googlesource.com", Name: "zoekt" }
]
EOF

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

This will mirror all repos under 'github.com/username' 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. See here for more information.

ACKNOWLEDGEMENTS

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

DISCLAIMER

This is not an official Google product

Documentation

Overview

Package cmd of the Zoekt kit contains the following CLI and Webservices:

Zoekt's clients:

- zoekt - Searching - CLI $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt $ $GOPATH/bin/zoekt 'ngram f:READ'

- zoekt-index - Indexing - CLI $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-index $ $GOPATH/bin/zoekt-index .

- zoekt-git-index - Indexing local git repositories - CLI $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-git-index $ $GOPATH/bin/zoekt-git-index -branches master,stable-1.4 -prefix origin/ .

- zoekt-repo-index - Indexing repo repositories - CLI $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-mirror-gitiles $ $GOPATH/bin/zoekt-mirror-gitiles -dest ~/repos/ https://gfiber.googlesource.com $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-repo-index

$ zoekt-repo-index \
  -name gfiber \
  -base_url https://gfiber.googlesource.com/ \
  -manifest_repo ~/repos/gfiber.googlesource.com/manifests.git \
  -repo_cache ~/repos \
  -manifest_rev_prefix=refs/heads/ --rev_prefix= \
  master:default_unrestricted.xml

- zoekt-mirror-gitiles - Mirror remote Gitiles - CLI $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-mirror-gitiles $ $GOPATH/bin/zoekt-mirror-gitiles -dest ~/repos/ --user avelino $ $GOPATH/bin/zoekt-mirror-gitiles -dest ~/repos/ --org segmentio

- zoekt-mirror-gerrit - Mirror remote Gerrit - CLI $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-mirror-gerrit $ $GOPATH/bin/zoekt-mirror-gerrit -dest ~/repos/ ssh://<USERNAME>@gerrit.wikimedia.org:29418/mediawiki/core.git

- zoekt-mirror-github - Mirror remote Github repositories - CLI $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-mirror-github $ $GOPATH/bin/zoekt-mirror-github -dest ~/repos/ https://github.com/google/go-github $ $GOPATH/bin/zoekt-mirror-github -dest ~/repos/ git://github.com/google/go-github.git

Zoekt's webservices:

- zoekt-indexserver - Indexing - SERVICE $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-indexserver $ $GOPATH/bin/zoekt-indexserver .

- zoekt - Web Interface $ go install github.com/sniperkit/snk.fork.zoekt/cmd/zoekt-webserver $ $GOPATH/bin/zoekt-webserver -listen :6070

Directories

Path Synopsis
cmd
zoekt
Zoekt - main
Zoekt - main
zoekt-archive-index
Zoekt Archive Index - main Command zoekt-archive-index indexes an archive.
Zoekt Archive Index - main Command zoekt-archive-index indexes an archive.
zoekt-git-index
Zoekt Git Index - main
Zoekt Git Index - main
zoekt-index
Zoekt Index - main
Zoekt Index - main
zoekt-indexserver
Zoekt Index Server - main
Zoekt Index Server - main
zoekt-mirror-gerrit
Zoekt Mirror Gerrit - main What is Gerrit ? https://www.mediawiki.org/wiki/Gerrit/Tutorial#What_is_Git?
Zoekt Mirror Gerrit - main What is Gerrit ? https://www.mediawiki.org/wiki/Gerrit/Tutorial#What_is_Git?
zoekt-mirror-github
Zoekt Mirror Github - main This binary fetches all repos of a user or organization and clones them.
Zoekt Mirror Github - main This binary fetches all repos of a user or organization and clones them.
zoekt-mirror-gitiles
Zoekt Mirror Gitiles - main This binary fetches all repos of a Gitiles host.
Zoekt Mirror Gitiles - main This binary fetches all repos of a Gitiles host.
zoekt-repo-index
Zoekt Repo Index - main zoekt-repo-index indexes a repo-based repository.
Zoekt Repo Index - main zoekt-repo-index indexes a repo-based repository.
zoekt-test
Zoekt Test - main zoekt-test compares the search engine results with raw substring search
Zoekt Test - main zoekt-test compares the search engine results with raw substring search
zoekt-webserver
Zoekt Webserver - main
Zoekt Webserver - main
pkg
build
package build implements a more convenient interface for building zoekt indices.
package build implements a more convenient interface for building zoekt indices.
gitindex
Package gitindex provides functions for indexing Git repositories.
Package gitindex provides functions for indexing Git repositories.
web
plugins
parser/gitignore
Package gitignore provides a Checker that can be used to determine whether a specific file is excluded by a .gitignore file.
Package gitignore provides a Checker that can be used to determine whether a specific file is excluded by a .gitignore file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL