Introduction
Hound is a lightweight and fast code search engine. Support Git, SVN, Mercurial, Bazaar. Hound itself is a static React front-end that can interact with the Go back-end. The back-end pulls and indexes the latest code library, and performs code search and page display through the API.
The effect is as shown in the figure
how to use
- Install Go
If it is a MAC and Homebrew has been installed, you can brew install go
directly to install it. For specific installation, please refer to Go official website: Install Go
- Download the Hound source package
git clone https://github.com/hound-search/hound.git
- Configure code warehouse address
cd hound
There is a default-config.json
file in the hound root directory, you can directly rename it to config.json, and then configure your own code warehouse address in it
mv default-config.json config.json
{
"dbpath" : "db",
"vcs-config" : {
"git": {
"ref" : "main"
}
},
"repos" : {
"Hound" : {
"url" : "https://github.com/hound-search/hound.git"
}
}
}
config-example.json
There are configuration examples for each warehouse in the file
The meaning of the specific configuration can refer to: hound config options
Common configuration example: only search the specified branch
"Hound" : {
"url" : "https://github.com/hound-search/hound.git",
"url-pattern": {
"base-url": "https://github.com/hound-search/hound/blob/指定的分支名/{path}{anchor}"
}
}
- Start Hound
go run src/hound/cmds/houndd/main.go
Under normal circumstances, you can see the following log information
2022/10/09 14:51:49 Searcher started for statsd
2022/10/09 14:51:49 Searcher started for Hound
2022/10/09 14:51:49 All indexes built !
2022/10/09 14:51:49 running server at http://localhost:6080
- use search
Visit http://localhost:6080/
to experience fast code search, click on the search result file to jump to the specified file in the corresponding code warehouse service