aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/web/explore/repo.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/routers/web/explore/repo.go b/routers/web/explore/repo.go
index b5485f5832..8cb615b7bc 100644
--- a/routers/web/explore/repo.go
+++ b/routers/web/explore/repo.go
@@ -48,10 +48,11 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
}
var (
- repos []*repo_model.Repository
- count int64
- err error
- orderBy db.SearchOrderBy
+ repos []*repo_model.Repository
+ count int64
+ err error
+ orderBy db.SearchOrderBy
+ onlyShowRelevant bool
)
ctx.Data["SortType"] = ctx.FormString("sort")
@@ -60,8 +61,6 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
orderBy = db.SearchOrderByNewest
case "oldest":
orderBy = db.SearchOrderByOldest
- case "recentupdate":
- orderBy = db.SearchOrderByRecentUpdated
case "leastupdate":
orderBy = db.SearchOrderByLeastUpdated
case "reversealphabetically":
@@ -83,9 +82,16 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
default:
ctx.Data["SortType"] = "recentupdate"
orderBy = db.SearchOrderByRecentUpdated
+ onlyShowRelevant = setting.UI.OnlyShowRelevantRepos && !ctx.FormBool("no_filter")
}
keyword := ctx.FormTrim("q")
+ if keyword != "" {
+ onlyShowRelevant = false
+ }
+
+ ctx.Data["OnlyShowRelevant"] = onlyShowRelevant
+
topicOnly := ctx.FormBool("topic")
ctx.Data["TopicOnly"] = topicOnly
@@ -107,6 +113,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
TopicOnly: topicOnly,
Language: language,
IncludeDescription: setting.UI.SearchRepoDescription,
+ OnlyShowRelevant: onlyShowRelevant,
})
if err != nil {
ctx.ServerError("SearchRepository", err)
@@ -133,6 +140,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
pager.SetDefaultParams(ctx)
pager.AddParam(ctx, "topic", "TopicOnly")
pager.AddParam(ctx, "language", "Language")
+ pager.AddParamString("no_filter", ctx.FormString("no_filter"))
ctx.Data["Page"] = pager
ctx.HTML(http.StatusOK, opts.TplName)