Skip to content

Commit ecc6b63

Browse files
Copilottrucpd
andcommitted
feat(search): support code search by zoekt
Add Zoekt indexer support for code search with the following features: - ZoektIndexer implementation for Unix systems - Noop implementation for non-Unix systems (zoekt only supports Unix) - Dynamic indexer path based on indexer type - Updated configuration documentation This implements PR go-gitea#33850 from go-gitea/gitea. Co-authored-by: trucpd <92442070+trucpd@users.noreply.github.com>
1 parent de2331c commit ecc6b63

File tree

7 files changed

+912
-229
lines changed

7 files changed

+912
-229
lines changed

custom/conf/app.example.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,10 +1384,10 @@ ROUTER = console
13841384
;; repo indexer by default disabled, since it uses a lot of disk space
13851385
;REPO_INDEXER_ENABLED = false
13861386
;;
1387-
;; Code search engine type, could be `bleve` or `elasticsearch`.
1387+
;; Code search engine type, could be `bleve`, `zoekt` or `elasticsearch`.
13881388
;REPO_INDEXER_TYPE = bleve
13891389
;;
1390-
;; Index file used for code search. available when `REPO_INDEXER_TYPE` is bleve
1390+
;; Index file used for code search. available when `REPO_INDEXER_TYPE` is bleve or zoekt
13911391
;REPO_INDEXER_PATH = indexers/repos.bleve
13921392
;;
13931393
;; Code indexer connection string, available when `REPO_INDEXER_TYPE` is elasticsearch. i.e. http://elastic:changeme@localhost:9200
@@ -1397,10 +1397,10 @@ ROUTER = console
13971397
;REPO_INDEXER_NAME = gitea_codes
13981398
;;
13991399
;; A comma separated list of glob patterns (see https://github.com/gobwas/glob) to include
1400-
;; in the index; default is empty
1400+
;; in the index; it's not compatible with the `zoekt` indexer type; default is empty
14011401
;REPO_INDEXER_INCLUDE =
14021402
;;
1403-
;; A comma separated list of glob patterns to exclude from the index; ; default is empty
1403+
;; A comma separated list of glob patterns to exclude from the index; it's not compatible with the `zoekt` indexer type; default is empty
14041404
;REPO_INDEXER_EXCLUDE =
14051405
;;
14061406
;;

go.mod

Lines changed: 68 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
module code.gitea.io/gitea
22

3-
go 1.19
3+
go 1.24.0
4+
5+
toolchain go1.24.12
46

57
require (
68
code.gitea.io/actions-proto-go v0.2.0
79
code.gitea.io/gitea-vet v0.2.2
8-
code.gitea.io/sdk/gitea v0.15.1
10+
code.gitea.io/sdk/gitea v0.20.0
911
codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570
1012
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681
1113
gitea.com/go-chi/cache v0.2.0
@@ -32,17 +34,17 @@ require (
3234
github.com/emersion/go-imap v1.2.1
3335
github.com/emirpasic/gods v1.18.1
3436
github.com/ethantkoenig/rupture v1.0.1
35-
github.com/felixge/fgprof v0.9.3
36-
github.com/fsnotify/fsnotify v1.6.0
37-
github.com/gliderlabs/ssh v0.3.5
37+
github.com/felixge/fgprof v0.9.5
38+
github.com/fsnotify/fsnotify v1.8.0
39+
github.com/gliderlabs/ssh v0.3.8
3840
github.com/go-ap/activitypub v0.0.0-20230218112952-bfb607b04799
3941
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73
4042
github.com/go-chi/chi/v5 v5.0.8
4143
github.com/go-chi/cors v1.2.1
42-
github.com/go-enry/go-enry/v2 v2.8.3
44+
github.com/go-enry/go-enry/v2 v2.9.1
4345
github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e
44-
github.com/go-git/go-billy/v5 v5.4.1
45-
github.com/go-git/go-git/v5 v5.5.2
46+
github.com/go-git/go-billy/v5 v5.6.2
47+
github.com/go-git/go-git/v5 v5.13.1
4648
github.com/go-ldap/ldap/v3 v3.4.4
4749
github.com/go-redis/redis/v8 v8.11.5
4850
github.com/go-sql-driver/mysql v1.7.0
@@ -55,23 +57,23 @@ require (
5557
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85
5658
github.com/golang-jwt/jwt/v4 v4.5.0
5759
github.com/google/go-github/v45 v45.2.0
58-
github.com/google/pprof v0.0.0-20230222194610-99052d3372e7
59-
github.com/google/uuid v1.3.0
60+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad
61+
github.com/google/uuid v1.6.0
6062
github.com/gorilla/feeds v1.1.1
6163
github.com/gorilla/sessions v1.2.1
62-
github.com/hashicorp/go-version v1.6.0
64+
github.com/hashicorp/go-version v1.7.0
6365
github.com/hashicorp/golang-lru v0.6.0
6466
github.com/huandu/xstrings v1.4.0
6567
github.com/jaytaylor/html2text v0.0.0-20211105163654-bc68cce691ba
6668
github.com/jhillyerd/enmime v0.10.1
6769
github.com/json-iterator/go v1.1.12
6870
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
6971
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
70-
github.com/klauspost/compress v1.15.15
72+
github.com/klauspost/compress v1.17.11
7173
github.com/klauspost/cpuid/v2 v2.2.4
7274
github.com/lib/pq v1.10.7
7375
github.com/markbates/goth v1.76.0
74-
github.com/mattn/go-isatty v0.0.17
76+
github.com/mattn/go-isatty v0.0.20
7577
github.com/mattn/go-sqlite3 v1.14.16
7678
github.com/mholt/archiver/v3 v3.5.1
7779
github.com/microcosm-cc/bluemonday v1.0.22
@@ -87,30 +89,31 @@ require (
8789
github.com/opencontainers/image-spec v1.1.0-rc2
8890
github.com/pkg/errors v0.9.1
8991
github.com/pquerna/otp v1.4.0
90-
github.com/prometheus/client_golang v1.14.0
92+
github.com/prometheus/client_golang v1.20.5
9193
github.com/quasoft/websspi v1.1.2
9294
github.com/santhosh-tekuri/jsonschema/v5 v5.2.0
93-
github.com/sergi/go-diff v1.3.1
95+
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
9496
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546
95-
github.com/stretchr/testify v1.8.1
97+
github.com/sourcegraph/zoekt v0.0.0-20251202141441-886b229dcd5e
98+
github.com/stretchr/testify v1.11.1
9699
github.com/syndtr/goleveldb v1.0.0
97100
github.com/tstranex/u2f v1.0.0
98101
github.com/unrolled/render v1.5.0
99102
github.com/urfave/cli v1.22.12
100103
github.com/xanzy/go-gitlab v0.80.2
101104
github.com/xeipuuv/gojsonschema v1.2.0
102105
github.com/yohcop/openid-go v1.0.0
103-
github.com/yuin/goldmark v1.5.4
106+
github.com/yuin/goldmark v1.7.13
104107
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20220924101305-151362477c87
105108
github.com/yuin/goldmark-meta v1.1.0
106-
golang.org/x/crypto v0.6.0
107-
golang.org/x/net v0.7.0
108-
golang.org/x/oauth2 v0.5.0
109-
golang.org/x/sys v0.5.0
110-
golang.org/x/text v0.7.0
111-
golang.org/x/tools v0.6.0
112-
google.golang.org/grpc v1.53.0
113-
google.golang.org/protobuf v1.28.1
109+
golang.org/x/crypto v0.45.0
110+
golang.org/x/net v0.47.0
111+
golang.org/x/oauth2 v0.30.0
112+
golang.org/x/sys v0.38.0
113+
golang.org/x/text v0.31.0
114+
golang.org/x/tools v0.38.0
115+
google.golang.org/grpc v1.75.0
116+
google.golang.org/protobuf v1.36.8
114117
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
115118
gopkg.in/ini.v1 v1.67.0
116119
gopkg.in/yaml.v3 v3.0.1
@@ -121,24 +124,24 @@ require (
121124
)
122125

123126
require (
124-
cloud.google.com/go/compute v1.18.0 // indirect
125-
cloud.google.com/go/compute/metadata v0.2.3 // indirect
127+
cloud.google.com/go/compute/metadata v0.7.0 // indirect
128+
dario.cat/mergo v1.0.1 // indirect
126129
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 // indirect
130+
github.com/42wim/httpsig v1.2.2 // indirect
127131
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
128132
github.com/Masterminds/goutils v1.1.1 // indirect
129133
github.com/Masterminds/semver/v3 v3.2.0 // indirect
130134
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
131-
github.com/Microsoft/go-winio v0.6.0 // indirect
132-
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
133-
github.com/RoaringBitmap/roaring v1.2.3 // indirect
134-
github.com/acomagu/bufpipe v1.0.3 // indirect
135+
github.com/Microsoft/go-winio v0.6.2 // indirect
136+
github.com/ProtonMail/go-crypto v1.1.5 // indirect
137+
github.com/RoaringBitmap/roaring v1.9.4 // indirect
135138
github.com/andybalholm/brotli v1.0.5 // indirect
136139
github.com/andybalholm/cascadia v1.3.1 // indirect
137140
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
138141
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
139142
github.com/aymerick/douceur v0.2.0 // indirect
140143
github.com/beorn7/perks v1.0.1 // indirect
141-
github.com/bits-and-blooms/bitset v1.5.0 // indirect
144+
github.com/bits-and-blooms/bitset v1.20.0 // indirect
142145
github.com/blevesearch/bleve_index_api v1.0.5 // indirect
143146
github.com/blevesearch/geo v0.1.17 // indirect
144147
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
@@ -154,26 +157,29 @@ require (
154157
github.com/blevesearch/zapx/v13 v13.3.7 // indirect
155158
github.com/blevesearch/zapx/v14 v14.3.7 // indirect
156159
github.com/blevesearch/zapx/v15 v15.3.9 // indirect
160+
github.com/bmatcuk/doublestar v1.3.4 // indirect
157161
github.com/boombuler/barcode v1.0.1 // indirect
158162
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
159163
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a // indirect
160-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
161-
github.com/cloudflare/circl v1.3.2 // indirect
164+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
165+
github.com/cloudflare/circl v1.6.1 // indirect
162166
github.com/couchbase/go-couchbase v0.0.0-20210224140812-5740cd35f448 // indirect
163167
github.com/couchbase/gomemcached v0.1.2 // indirect
164168
github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401 // indirect
165169
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
170+
github.com/cyphar/filepath-securejoin v0.4.0 // indirect
166171
github.com/davecgh/go-spew v1.1.1 // indirect
172+
github.com/davidmz/go-pageant v1.0.2 // indirect
167173
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
168174
github.com/dlclark/regexp2 v1.8.1 // indirect
169175
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 // indirect
170-
github.com/fatih/color v1.13.0 // indirect
171-
github.com/felixge/httpsnoop v1.0.3 // indirect
176+
github.com/fatih/color v1.18.0 // indirect
177+
github.com/felixge/httpsnoop v1.0.4 // indirect
172178
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
173179
github.com/go-ap/errors v0.0.0-20221205040414-01c1adfc98ea // indirect
174180
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
175181
github.com/go-enry/go-oniguruma v1.2.1 // indirect
176-
github.com/go-git/gcfg v1.5.0 // indirect
182+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
177183
github.com/go-ini/ini v1.67.0 // indirect
178184
github.com/go-openapi/analysis v0.21.4 // indirect
179185
github.com/go-openapi/errors v0.20.3 // indirect
@@ -191,18 +197,21 @@ require (
191197
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
192198
github.com/golang-sql/sqlexp v0.1.0 // indirect
193199
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
194-
github.com/golang/protobuf v1.5.2 // indirect
200+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
201+
github.com/golang/protobuf v1.5.4 // indirect
195202
github.com/golang/snappy v0.0.4 // indirect
196203
github.com/google/go-querystring v1.1.0 // indirect
197204
github.com/google/go-tpm v0.3.3 // indirect
198205
github.com/gorilla/css v1.0.0 // indirect
199206
github.com/gorilla/handlers v1.5.1 // indirect
200207
github.com/gorilla/mux v1.8.0 // indirect
201208
github.com/gorilla/securecookie v1.1.1 // indirect
209+
github.com/grafana/regexp v0.0.0-20240607082908-2cb410fa05da // indirect
210+
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
202211
github.com/hashicorp/errwrap v1.1.0 // indirect
203212
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
204213
github.com/hashicorp/go-multierror v1.1.1 // indirect
205-
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
214+
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
206215
github.com/hashicorp/hcl v1.0.0 // indirect
207216
github.com/imdario/mergo v0.3.13 // indirect
208217
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -216,9 +225,8 @@ require (
216225
github.com/magiconair/properties v1.8.6 // indirect
217226
github.com/mailru/easyjson v0.7.7 // indirect
218227
github.com/markbates/going v1.0.0 // indirect
219-
github.com/mattn/go-colorable v0.1.13 // indirect
228+
github.com/mattn/go-colorable v0.1.14 // indirect
220229
github.com/mattn/go-runewidth v0.0.14 // indirect
221-
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
222230
github.com/mholt/acmez v1.1.0 // indirect
223231
github.com/miekg/dns v1.1.50 // indirect
224232
github.com/minio/md5-simd v1.1.2 // indirect
@@ -229,27 +237,30 @@ require (
229237
github.com/modern-go/reflect2 v1.0.2 // indirect
230238
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 // indirect
231239
github.com/mschoch/smat v0.2.0 // indirect
240+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
232241
github.com/nwaples/rardecode v1.1.3 // indirect
233242
github.com/oklog/ulid v1.3.1 // indirect
234243
github.com/olekukonko/tablewriter v0.0.5 // indirect
244+
github.com/opentracing/opentracing-go v1.2.0 // indirect
235245
github.com/pelletier/go-toml v1.9.5 // indirect
236246
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
237247
github.com/pierrec/lz4/v4 v4.1.17 // indirect
238-
github.com/pjbgf/sha1cd v0.2.3 // indirect
248+
github.com/pjbgf/sha1cd v0.3.2 // indirect
239249
github.com/pmezard/go-difflib v1.0.0 // indirect
240-
github.com/prometheus/client_model v0.3.0 // indirect
241-
github.com/prometheus/common v0.37.0 // indirect
242-
github.com/prometheus/procfs v0.8.0 // indirect
250+
github.com/prometheus/client_model v0.6.1 // indirect
251+
github.com/prometheus/common v0.62.0 // indirect
252+
github.com/prometheus/procfs v0.15.1 // indirect
243253
github.com/rhysd/actionlint v1.6.22 // indirect
244254
github.com/rivo/uniseg v0.4.4 // indirect
245255
github.com/robfig/cron v1.2.0 // indirect
246-
github.com/rogpeppe/go-internal v1.9.0 // indirect
247-
github.com/rs/xid v1.4.0 // indirect
256+
github.com/rogpeppe/go-internal v1.13.1 // indirect
257+
github.com/rs/xid v1.6.0 // indirect
248258
github.com/russross/blackfriday/v2 v2.1.0 // indirect
249259
github.com/shopspring/decimal v1.2.0 // indirect
250260
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
251-
github.com/sirupsen/logrus v1.9.0 // indirect
252-
github.com/skeema/knownhosts v1.1.0 // indirect
261+
github.com/sirupsen/logrus v1.9.3 // indirect
262+
github.com/skeema/knownhosts v1.3.0 // indirect
263+
github.com/sourcegraph/go-ctags v0.0.0-20250729094530-349a251d78d8 // indirect
253264
github.com/spf13/afero v1.9.2 // indirect
254265
github.com/spf13/cast v1.5.0 // indirect
255266
github.com/spf13/jwalterweatherman v1.1.0 // indirect
@@ -268,14 +279,14 @@ require (
268279
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
269280
go.etcd.io/bbolt v1.3.7 // indirect
270281
go.mongodb.org/mongo-driver v1.11.1 // indirect
271-
go.uber.org/atomic v1.10.0 // indirect
272-
go.uber.org/multierr v1.9.0 // indirect
273-
go.uber.org/zap v1.24.0 // indirect
274-
golang.org/x/mod v0.8.0 // indirect
275-
golang.org/x/sync v0.1.0 // indirect
276-
golang.org/x/time v0.3.0 // indirect
277-
google.golang.org/appengine v1.6.7 // indirect
278-
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 // indirect
282+
go.uber.org/atomic v1.11.0 // indirect
283+
go.uber.org/multierr v1.11.0 // indirect
284+
go.uber.org/zap v1.27.0 // indirect
285+
golang.org/x/mod v0.29.0 // indirect
286+
golang.org/x/sync v0.18.0 // indirect
287+
golang.org/x/time v0.11.0 // indirect
288+
golang.org/x/tools/godoc v0.1.0-deprecated // indirect
289+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
279290
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
280291
gopkg.in/warnings.v0 v0.1.2 // indirect
281292
gopkg.in/yaml.v2 v2.4.0 // indirect

0 commit comments

Comments
 (0)