From b674fed230bcd6488b796f49de5505cbaf448b07 Mon Sep 17 00:00:00 2001 From: Paul Martin Date: Sat, 16 Apr 2016 16:41:45 +0100 Subject: [PATCH] fixes #966 to prevent always searching all repos --- .../java/com/gitblit/wicket/pages/LuceneSearchPage.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.java b/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.java index b2fd9037..1d81061e 100644 --- a/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.java +++ b/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.java @@ -66,6 +66,8 @@ public class LuceneSearchPage extends RootPage { // default values ArrayList repositories = new ArrayList(); String query = ""; + boolean allRepos = false; + int page = 1; int pageSize = app().settings().getInteger(Keys.web.itemsPerPage, 50); @@ -91,8 +93,9 @@ public class LuceneSearchPage extends RootPage { List list = StringUtils.getStringsFromValue(value); repositories.addAll(list); } - - if (params.containsKey("allrepos")) { + + allRepos = params.getAsBoolean("allrepos", false); + if (allRepos) { repositories.addAll(availableRepositories); } @@ -133,7 +136,7 @@ public class LuceneSearchPage extends RootPage { // search form final Model queryModel = new Model(query); final Model> repositoriesModel = new Model>(searchRepositories); - final Model allreposModel = new Model(params != null && params.containsKey("allrepos")); + final Model allreposModel = new Model(allRepos); SessionlessForm form = new SessionlessForm("searchForm", getClass()) { private static final long serialVersionUID = 1L; -- 2.39.5