From: Paul Martin Date: Sat, 16 Apr 2016 15:41:45 +0000 (+0100) Subject: fixes #966 to prevent always searching all repos X-Git-Tag: v1.8.0~10^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b674fed230bcd6488b796f49de5505cbaf448b07;p=gitblit.git fixes #966 to prevent always searching all repos --- 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;