diff options
author | 6543 <m.huber@kithara.com> | 2024-03-16 11:32:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-16 10:32:45 +0000 |
commit | 1262ff6734543b37d834e63a6a623648c77ee4f4 (patch) | |
tree | cc99d1a96d094881a820659ea7fdf2d326b8a862 /modules/indexer/code/internal/indexer.go | |
parent | e0ea3811c4178ffa30452b7ca4bd211e59326f91 (diff) | |
download | gitea-1262ff6734543b37d834e63a6a623648c77ee4f4.tar.gz gitea-1262ff6734543b37d834e63a6a623648c77ee4f4.zip |
Refactor code_indexer to use an SearchOptions struct for PerformSearch (#29724)
similar to how it's already done for the issue_indexer
---
*Sponsored by Kithara Software GmbH*
Diffstat (limited to 'modules/indexer/code/internal/indexer.go')
-rw-r--r-- | modules/indexer/code/internal/indexer.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/indexer/code/internal/indexer.go b/modules/indexer/code/internal/indexer.go index c92419deb2..c259fcd26e 100644 --- a/modules/indexer/code/internal/indexer.go +++ b/modules/indexer/code/internal/indexer.go @@ -7,6 +7,7 @@ import ( "context" "fmt" + "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/indexer/internal" ) @@ -16,7 +17,17 @@ type Indexer interface { internal.Indexer Index(ctx context.Context, repo *repo_model.Repository, sha string, changes *RepoChanges) error Delete(ctx context.Context, repoID int64) error - Search(ctx context.Context, repoIDs []int64, language, keyword string, page, pageSize int, isFuzzy bool) (int64, []*SearchResult, []*SearchResultLanguages, error) + Search(ctx context.Context, opts *SearchOptions) (int64, []*SearchResult, []*SearchResultLanguages, error) +} + +type SearchOptions struct { + RepoIDs []int64 + Keyword string + Language string + + IsKeywordFuzzy bool + + db.Paginator } // NewDummyIndexer returns a dummy indexer @@ -38,6 +49,6 @@ func (d *dummyIndexer) Delete(ctx context.Context, repoID int64) error { return fmt.Errorf("indexer is not ready") } -func (d *dummyIndexer) Search(ctx context.Context, repoIDs []int64, language, keyword string, page, pageSize int, isFuzzy bool) (int64, []*SearchResult, []*SearchResultLanguages, error) { +func (d *dummyIndexer) Search(ctx context.Context, opts *SearchOptions) (int64, []*SearchResult, []*SearchResultLanguages, error) { return 0, nil, nil, fmt.Errorf("indexer is not ready") } |