summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-02-19 22:39:39 +0800
committertechknowlogick <matti@mdranta.net>2019-02-19 09:39:39 -0500
commit830ae614560b0c504c00d693b63d9889bac1a2d8 (patch)
tree5fd933f8124f4dd30d0215def2a7bcc0181573be /routers
parent094263db4d9f1b53c4b4c021005eec07baddd253 (diff)
downloadgitea-830ae614560b0c504c00d693b63d9889bac1a2d8.tar.gz
gitea-830ae614560b0c504c00d693b63d9889bac1a2d8.zip
Refactor issue indexer (#5363)
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/issue.go3
-rw-r--r--routers/init.go4
-rw-r--r--routers/repo/issue.go7
3 files changed, 9 insertions, 5 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index d339d8f0b7..b13af33548 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -13,7 +13,6 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
- "code.gitea.io/gitea/modules/indexer"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
@@ -78,7 +77,7 @@ func ListIssues(ctx *context.APIContext) {
var labelIDs []int64
var err error
if len(keyword) > 0 {
- issueIDs, err = indexer.SearchIssuesByKeyword(ctx.Repo.Repository.ID, keyword)
+ issueIDs, err = models.SearchIssuesByKeyword(ctx.Repo.Repository.ID, keyword)
}
if splitted := strings.Split(ctx.Query("labels"), ","); len(splitted) > 0 {
diff --git a/routers/init.go b/routers/init.go
index 4da786cc00..1da21a351b 100644
--- a/routers/init.go
+++ b/routers/init.go
@@ -90,7 +90,9 @@ func GlobalInit() {
// Booting long running goroutines.
cron.NewContext()
- models.InitIssueIndexer()
+ if err := models.InitIssueIndexer(); err != nil {
+ log.Fatal(4, "Failed to initialize issue indexer: %v", err)
+ }
models.InitRepoIndexer()
models.InitSyncMirrors()
models.InitDeliverHooks()
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 6783d279b5..1843e00144 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -23,7 +23,6 @@ import (
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
- "code.gitea.io/gitea/modules/indexer"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/notification"
@@ -147,7 +146,11 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
var issueIDs []int64
if len(keyword) > 0 {
- issueIDs, err = indexer.SearchIssuesByKeyword(repo.ID, keyword)
+ issueIDs, err = models.SearchIssuesByKeyword(repo.ID, keyword)
+ if err != nil {
+ ctx.ServerError("issueIndexer.Search", err)
+ return
+ }
if len(issueIDs) == 0 {
forceEmpty = true
}