aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2023-05-25 04:13:47 -0400
committerGitHub <noreply@github.com>2023-05-25 16:13:47 +0800
commit033d92997fc16baee097d2b25f08e0984e628abd (patch)
tree731c2ed48759bbb86baeb837c7da8a06078a03a3 /modules/setting
parentcff4e37d43595d0ad22b634c274d62b04ab9a468 (diff)
downloadgitea-033d92997fc16baee097d2b25f08e0984e628abd.tar.gz
gitea-033d92997fc16baee097d2b25f08e0984e628abd.zip
Allow skipping forks and mirrors from being indexed (#23187)
This PR adds two new options to disable repo/code search indexing of both forks and mirrors. Related: #22842
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/indexer.go35
1 files changed, 19 insertions, 16 deletions
diff --git a/modules/setting/indexer.go b/modules/setting/indexer.go
index 6836e62311..16f3d80168 100644
--- a/modules/setting/indexer.go
+++ b/modules/setting/indexer.go
@@ -23,15 +23,16 @@ var Indexer = struct {
IssueIndexerName string
StartupTimeout time.Duration
- RepoIndexerEnabled bool
- RepoType string
- RepoPath string
- RepoConnStr string
- RepoIndexerName string
- MaxIndexerFileSize int64
- IncludePatterns []glob.Glob
- ExcludePatterns []glob.Glob
- ExcludeVendored bool
+ RepoIndexerEnabled bool
+ RepoIndexerRepoTypes []string
+ RepoType string
+ RepoPath string
+ RepoConnStr string
+ RepoIndexerName string
+ MaxIndexerFileSize int64
+ IncludePatterns []glob.Glob
+ ExcludePatterns []glob.Glob
+ ExcludeVendored bool
}{
IssueType: "bleve",
IssuePath: "indexers/issues.bleve",
@@ -39,13 +40,14 @@ var Indexer = struct {
IssueConnAuth: "",
IssueIndexerName: "gitea_issues",
- RepoIndexerEnabled: false,
- RepoType: "bleve",
- RepoPath: "indexers/repos.bleve",
- RepoConnStr: "",
- RepoIndexerName: "gitea_codes",
- MaxIndexerFileSize: 1024 * 1024,
- ExcludeVendored: true,
+ RepoIndexerEnabled: false,
+ RepoIndexerRepoTypes: []string{"sources", "forks", "mirrors", "templates"},
+ RepoType: "bleve",
+ RepoPath: "indexers/repos.bleve",
+ RepoConnStr: "",
+ RepoIndexerName: "gitea_codes",
+ MaxIndexerFileSize: 1024 * 1024,
+ ExcludeVendored: true,
}
func loadIndexerFrom(rootCfg ConfigProvider) {
@@ -71,6 +73,7 @@ func loadIndexerFrom(rootCfg ConfigProvider) {
Indexer.IssueIndexerName = sec.Key("ISSUE_INDEXER_NAME").MustString(Indexer.IssueIndexerName)
Indexer.RepoIndexerEnabled = sec.Key("REPO_INDEXER_ENABLED").MustBool(false)
+ Indexer.RepoIndexerRepoTypes = strings.Split(sec.Key("REPO_INDEXER_REPO_TYPES").MustString("sources,forks,mirrors,templates"), ",")
Indexer.RepoType = sec.Key("REPO_INDEXER_TYPE").MustString("bleve")
Indexer.RepoPath = filepath.ToSlash(sec.Key("REPO_INDEXER_PATH").MustString(filepath.ToSlash(filepath.Join(AppDataPath, "indexers/repos.bleve"))))
if !filepath.IsAbs(Indexer.RepoPath) {