fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

docs: document JSON API (#265)

author
Stefan Hengl
committer
GitHub
date (Feb 10, 2022, 10:57 AM +0100) commit 840d5e43 parent 5f70fa01
+39 -28
+39 -28
README.md
··· 11 11 main maintained source of Zoekt. The go module is still 12 12 `github.com/google/zoekt` for now, but will be updated in the future. 13 13 14 - INSTRUCTIONS 15 - ============ 14 + # INSTRUCTIONS 16 15 17 - Downloading: 16 + ## Downloading 18 17 19 18 go get github.com/google/zoekt/ 20 19 21 - Indexing: 20 + ## Indexing 21 + 22 + ### Directory 22 23 23 24 go install github.com/google/zoekt/cmd/zoekt-index 24 25 $GOPATH/bin/zoekt-index . 25 26 26 - Searching 27 - 28 - go install github.com/google/zoekt/cmd/zoekt 29 - $GOPATH/bin/zoekt 'ngram f:READ' 30 - 31 - Indexing git repositories: 27 + ### Git repository 32 28 33 29 go install github.com/google/zoekt/cmd/zoekt-git-index 34 30 $GOPATH/bin/zoekt-git-index -branches master,stable-1.4 -prefix origin/ . 35 31 36 - Indexing repo repositories: 32 + ### Repo repositories 37 33 38 34 go install github.com/google/zoekt/cmd/zoekt-{repo-index,mirror-gitiles} 39 35 zoekt-mirror-gitiles -dest ~/repos/ https://gfiber.googlesource.com 40 36 zoekt-repo-index \ 41 - -name gfiber \ 42 - -base_url https://gfiber.googlesource.com/ \ 43 - -manifest_repo ~/repos/gfiber.googlesource.com/manifests.git \ 44 - -repo_cache ~/repos \ 45 - -manifest_rev_prefix=refs/heads/ --rev_prefix= \ 46 - master:default_unrestricted.xml 37 + -name gfiber \ 38 + -base_url https://gfiber.googlesource.com/ \ 39 + -manifest_repo ~/repos/gfiber.googlesource.com/manifests.git \ 40 + -repo_cache ~/repos \ 41 + -manifest_rev_prefix=refs/heads/ --rev_prefix= \ 42 + master:default_unrestricted.xml 43 + 44 + ## Searching 47 45 48 - Starting the web interface 46 + ### Web interface 49 47 50 48 go install github.com/google/zoekt/cmd/zoekt-webserver 51 49 $GOPATH/bin/zoekt-webserver -listen :6070 52 50 51 + ### JSON API 52 + 53 + You can retrieve search results as JSON by sending a GET request to zoekt-webserver. 54 + 55 + curl --get \ 56 + --url "http://localhost:6070/search" \ 57 + --data-urlencode "q=ngram f:READ" \ 58 + --data-urlencode "num=50" \ 59 + --data-urlencode "format=json" 60 + 61 + The response data is a JSON object. You can refer to [web.ApiSearchResult](https://sourcegraph.com/github.com/sourcegraph/zoekt@6b1df4f8a3d7b34f13ba0cafd8e1a9b3fc728cf0/-/blob/web/api.go?L23:6&subtree=true) to learn about the structure of the object. 62 + 63 + ### CLI 64 + 65 + go install github.com/google/zoekt/cmd/zoekt 66 + $GOPATH/bin/zoekt 'ngram f:READ' 67 + 68 + ## Installation 53 69 A more organized installation on a Linux server should use a systemd unit file, 54 70 eg. 55 71 ··· 64 80 WantedBy=default.target 65 81 66 82 67 - SEARCH SERVICE 68 - ============== 83 + # SEARCH SERVICE 69 84 70 85 Zoekt comes with a small service management program: 71 86 ··· 89 104 as systemd. 90 105 91 106 92 - SYMBOL SEARCH 93 - ============= 107 + # SYMBOL SEARCH 94 108 95 109 It is recommended to install [Universal 96 110 ctags](https://github.com/universal-ctags/ctags) to improve 97 111 ranking. See [here](doc/ctags.md) for more information. 98 112 99 113 100 - ACKNOWLEDGEMENTS 101 - ================ 114 + # ACKNOWLEDGEMENTS 102 115 103 116 Thanks to Han-Wen Nienhuys for creating Zoekt. Thanks to Alexander Neubeck for 104 117 coming up with this idea, and helping Han-Wen Nienhuys flesh it out. 105 118 106 119 107 - FORK DETAILS 108 - ============== 120 + # FORK DETAILS 109 121 110 122 Originally this fork contained some changes that do not make sense to upstream 111 123 and or have not yet been upstreamed. However, this is now the defacto source ··· 134 146 $ git diff gerrit/master -- ':(exclude)vendor/' ':(exclude)Gopkg*' 135 147 ``` 136 148 137 - DISCLAIMER 138 - ========== 149 + # DISCLAIMER 139 150 140 151 This is not an official Google product