diff --git a/routers/web/explore/code.go b/routers/web/explore/code.go index 4db41fd726..7a3f6a5a86 100644 --- a/routers/web/explore/code.go +++ b/routers/web/explore/code.go @@ -45,7 +45,6 @@ func Code(ctx *context.Context) { ctx.Data["Keyword"] = keyword ctx.Data["Language"] = language ctx.Data["CodeSearchOptions"] = []string{"exact", "fuzzy"} - ctx.Data["IsFuzzy"] = isFuzzy if isFuzzy { ctx.Data["CodeSearchMode"] = "fuzzy" } else { diff --git a/routers/web/repo/search.go b/routers/web/repo/search.go index 724bb82612..863a279af0 100644 --- a/routers/web/repo/search.go +++ b/routers/web/repo/search.go @@ -63,8 +63,6 @@ func Search(ctx *context.Context) { ctx.Data["Keyword"] = keyword ctx.Data["Language"] = language - ctx.Data["IsFuzzy"] = mode == FuzzySearchMode - ctx.Data["IsRegExp"] = mode == RegExpSearchMode ctx.Data["CodeSearchMode"] = mode.String() ctx.Data["PageIsViewCode"] = true diff --git a/routers/web/user/code.go b/routers/web/user/code.go index 9e8614cb04..bf4cbb8920 100644 --- a/routers/web/user/code.go +++ b/routers/web/user/code.go @@ -50,7 +50,6 @@ func CodeSearch(ctx *context.Context) { ctx.Data["Keyword"] = keyword ctx.Data["Language"] = language ctx.Data["CodeSearchOptions"] = []string{"exact", "fuzzy"} - ctx.Data["IsFuzzy"] = isFuzzy if isFuzzy { ctx.Data["CodeSearchMode"] = "fuzzy" } else { diff --git a/templates/repo/search.tmpl b/templates/repo/search.tmpl index 6d114c81e4..34707bc8da 100644 --- a/templates/repo/search.tmpl +++ b/templates/repo/search.tmpl @@ -5,7 +5,7 @@ {{if $.CodeIndexerDisabled}} {{$branchURLPrefix := printf "%s/search/branch/" $.RepoLink}} {{$tagURLPrefix := printf "%s/search/tag/" $.RepoLink}} - {{$suffix := printf "?q=%s&fuzzy=%t" (.Keyword|QueryEscape) .IsFuzzy}} + {{$suffix := printf "?q=%s&mode=%s" (.Keyword|QueryEscape) .CodeSearchMode}} {{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mb-3" "branchURLPrefix" $branchURLPrefix "branchURLSuffix" $suffix "tagURLPrefix" $tagURLPrefix "tagURLSuffix" $suffix}} {{end}} {{template "shared/search/code/search" .}} diff --git a/templates/shared/search/code/results.tmpl b/templates/shared/search/code/results.tmpl index fe375579bd..98c5430502 100644 --- a/templates/shared/search/code/results.tmpl +++ b/templates/shared/search/code/results.tmpl @@ -1,7 +1,7 @@
{{range $term := .SearchResultLanguages}} + href="?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}&mode={{$.CodeSearchMode}}"> {{$term.Language}}
{{$term.Count}}