1
0
Fork 0
forked from forgejo/forgejo

Add more tests and docs for issue indexer, add db indexer type for searching from database (#6144)

* add more tests and docs for issue indexer, add db indexer type for searching from database

* fix typo

* fix typo

* fix lint

* improve docs
This commit is contained in:
Lunny Xiao 2019-02-21 13:01:28 +08:00 committed by GitHub
parent 0751153613
commit 477ef46251
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 174 additions and 11 deletions

View file

@ -33,7 +33,8 @@ type Match struct {
// SearchResult represents search results
type SearchResult struct {
Hits []Match
Total int64
Hits []Match
}
// Indexer defines an inteface to indexer issues contents
@ -54,6 +55,7 @@ var (
// all issue index done.
func InitIssueIndexer(syncReindex bool) error {
var populate bool
var dummyQueue bool
switch setting.Indexer.IssueType {
case "bleve":
issueIndexer = NewBleveIndexer(setting.Indexer.IssuePath)
@ -62,10 +64,17 @@ func InitIssueIndexer(syncReindex bool) error {
return err
}
populate = !exist
case "db":
issueIndexer = &DBIndexer{}
dummyQueue = true
default:
return fmt.Errorf("unknow issue indexer type: %s", setting.Indexer.IssueType)
}
if dummyQueue {
return nil
}
var err error
switch setting.Indexer.IssueIndexerQueueType {
case setting.LevelQueueType: