From: James Moger Date: Mon, 5 Oct 2015 12:04:10 +0000 (-0400) Subject: Ensure a repository is only searched once X-Git-Tag: v1.7.0~1^2~12^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=548b29e87dedac76bad2011cda4e39a9f3d72a21;p=gitblit.git Ensure a repository is only searched once --- diff --git a/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.java b/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.java index ec822318..b2fd9037 100644 --- a/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.java +++ b/src/main/java/com/gitblit/wicket/pages/LuceneSearchPage.java @@ -17,14 +17,16 @@ package com.gitblit.wicket.pages; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; import org.apache.wicket.Component; import org.apache.wicket.PageParameters; import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.CheckBox; import org.apache.wicket.markup.html.form.ListMultipleChoice; import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.markup.html.form.CheckBox; import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; @@ -120,12 +122,13 @@ public class LuceneSearchPage extends RootPage { } // enforce user-accessible repository selections - ArrayList searchRepositories = new ArrayList(); + Set uniqueRepositories = new LinkedHashSet(); for (String selectedRepository : repositories) { if (availableRepositories.contains(selectedRepository)) { - searchRepositories.add(selectedRepository); + uniqueRepositories.add(selectedRepository); } } + ArrayList searchRepositories = new ArrayList(uniqueRepositories); // search form final Model queryModel = new Model(query);