Support elastic search for code search (#10273)
* Support elastic search for code search * Finished elastic search implementation and add some tests * Enable test on drone and added docs * Add new fields to elastic search * Fix bug * remove unused changes * Use indexer alias to keep the gitea indexer version * Improve codes * Some code improvements * The real indexer name changed to xxx.v1 Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
d257485bc0
commit
9bc69ff26e
14 changed files with 694 additions and 164 deletions
|
@ -7,6 +7,8 @@ package code
|
|||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -55,12 +57,12 @@ func (w *wrappedIndexer) get() (Indexer, error) {
|
|||
return w.internal, nil
|
||||
}
|
||||
|
||||
func (w *wrappedIndexer) Index(repoID int64) error {
|
||||
func (w *wrappedIndexer) Index(repo *models.Repository, sha string, changes *repoChanges) error {
|
||||
indexer, err := w.get()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return indexer.Index(repoID)
|
||||
return indexer.Index(repo, sha, changes)
|
||||
}
|
||||
|
||||
func (w *wrappedIndexer) Delete(repoID int64) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue