mirror of
https://github.com/go-gitea/gitea
synced 2025-07-08 03:27:19 +00:00
Improve issue & code search (#33860)
Each "indexer" should provide the "search modes" they support by themselves. And we need to remove the "fuzzy" search for code.
This commit is contained in:
@ -26,6 +26,7 @@ import (
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/container"
|
||||
"code.gitea.io/gitea/modules/indexer"
|
||||
issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
@ -447,7 +448,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
||||
ctx.Data["FilterAssigneeUsername"] = assigneeUsername
|
||||
opts.AssigneeID = user.GetFilterUserIDByName(ctx, assigneeUsername)
|
||||
|
||||
isFuzzy := ctx.FormBool("fuzzy")
|
||||
searchMode := ctx.FormString("search_mode")
|
||||
|
||||
// Search all repositories which
|
||||
//
|
||||
@ -549,7 +550,9 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
||||
var issues issues_model.IssueList
|
||||
{
|
||||
issueIDs, _, err := issue_indexer.SearchIssues(ctx, issue_indexer.ToSearchOptions(keyword, opts).Copy(
|
||||
func(o *issue_indexer.SearchOptions) { o.IsFuzzyKeyword = isFuzzy },
|
||||
func(o *issue_indexer.SearchOptions) {
|
||||
o.SearchMode = indexer.SearchModeType(searchMode)
|
||||
},
|
||||
))
|
||||
if err != nil {
|
||||
ctx.ServerError("issueIDsFromSearch", err)
|
||||
@ -578,7 +581,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
||||
// -------------------------------
|
||||
issueStats, err := getUserIssueStats(ctx, ctxUser, filterMode, issue_indexer.ToSearchOptions(keyword, opts).Copy(
|
||||
func(o *issue_indexer.SearchOptions) {
|
||||
o.IsFuzzyKeyword = isFuzzy
|
||||
o.SearchMode = indexer.SearchModeType(searchMode)
|
||||
},
|
||||
))
|
||||
if err != nil {
|
||||
@ -633,7 +636,8 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
||||
ctx.Data["ViewType"] = viewType
|
||||
ctx.Data["SortType"] = sortType
|
||||
ctx.Data["IsShowClosed"] = isShowClosed
|
||||
ctx.Data["IsFuzzy"] = isFuzzy
|
||||
ctx.Data["SearchModes"] = issue_indexer.SupportedSearchModes()
|
||||
ctx.Data["SelectedSearchMode"] = ctx.FormTrim("search_mode")
|
||||
|
||||
if isShowClosed {
|
||||
ctx.Data["State"] = "closed"
|
||||
|
Reference in New Issue
Block a user