aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/user/code.go
diff options
context:
space:
mode:
author6543 <m.huber@kithara.com>2024-03-16 11:32:45 +0100
committerGitHub <noreply@github.com>2024-03-16 10:32:45 +0000
commit1262ff6734543b37d834e63a6a623648c77ee4f4 (patch)
treecc99d1a96d094881a820659ea7fdf2d326b8a862 /routers/web/user/code.go
parente0ea3811c4178ffa30452b7ca4bd211e59326f91 (diff)
downloadgitea-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 'routers/web/user/code.go')
-rw-r--r--routers/web/user/code.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/routers/web/user/code.go b/routers/web/user/code.go
index a8ac50639d..7ce3e12192 100644
--- a/routers/web/user/code.go
+++ b/routers/web/user/code.go
@@ -6,6 +6,7 @@ package user
import (
"net/http"
+ "code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/base"
code_indexer "code.gitea.io/gitea/modules/indexer/code"
@@ -74,7 +75,16 @@ func CodeSearch(ctx *context.Context) {
)
if len(repoIDs) > 0 {
- total, searchResults, searchResultLanguages, err = code_indexer.PerformSearch(ctx, repoIDs, language, keyword, page, setting.UI.RepoSearchPagingNum, isFuzzy)
+ total, searchResults, searchResultLanguages, err = code_indexer.PerformSearch(ctx, &code_indexer.SearchOptions{
+ RepoIDs: repoIDs,
+ Keyword: keyword,
+ IsKeywordFuzzy: isFuzzy,
+ Language: language,
+ Paginator: &db.ListOptions{
+ Page: page,
+ PageSize: setting.UI.RepoSearchPagingNum,
+ },
+ })
if err != nil {
if code_indexer.IsAvailable(ctx) {
ctx.ServerError("SearchResults", err)