The Unified and Autonomous Development Platform
More minor fixes.
robin shine53fb5cfdae48
diff --git a/commons.git/src/main/java/com/pmease/commons/git/BlobIdent.java b/commons.git/src/main/java/com/pmease/commons/git/BlobIdent.javaindex 1ac1e8d056..77801255cf 100644--- a/commons.git/src/main/java/com/pmease/commons/git/BlobIdent.java+++ b/commons.git/src/main/java/com/pmease/commons/git/BlobIdent.java@@ -27,6 +27,10 @@ public class BlobIdent implements Serializable, Comparable<BlobIdent> {public BlobIdent() {}+ public BlobIdent(BlobIdent copy) {+ this(copy.revision, copy.path, copy.mode);+ }+public BlobIdent(@Nullable String revision, @Nullable String path, @Nullable Integer mode) {this.revision = revision;this.path = path;diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/codemirror/codemirror.css b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/codemirror/codemirror.cssindex e1fef70654..cfa7780524 100644--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/codemirror/codemirror.css+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/codemirror/codemirror.css@@ -1,5 +1,5 @@.cm-identifierhighlight {- background: #D0D0D0;+ background: #ACF0A6;}.CodeMirror-selected {background-color: #3399FF !important;@@ -35,17 +35,17 @@max-height: 600px;}.CodeMirror-search-match {- background: orange;- border-top: 1px solid orange;- border-bottom: 1px solid orange;+ background: gold;+ border-top: 1px solid gold;+ border-bottom: 1px solid gold;-moz-box-sizing: border-box;box-sizing: border-box;opacity: .5;}.CodeMirror-search-match2 {- background: #666;- border-top: 1px solid #666;- border-bottom: 1px solid #666;+ background: #68E55D;+ border-top: 1px solid #68E55D;+ border-bottom: 1px solid #68E55D;-moz-box-sizing: border-box;box-sizing: border-box;opacity: .5;diff --git a/gitplex.search/src/main/java/com/pmease/gitplex/search/SearchManager.java b/gitplex.search/src/main/java/com/pmease/gitplex/search/SearchManager.javaindex b941089bf4..b201358044 100644--- a/gitplex.search/src/main/java/com/pmease/gitplex/search/SearchManager.java+++ b/gitplex.search/src/main/java/com/pmease/gitplex/search/SearchManager.java@@ -5,9 +5,20 @@ import java.util.List;import com.pmease.gitplex.core.model.Repository;import com.pmease.gitplex.search.hit.QueryHit;import com.pmease.gitplex.search.query.BlobQuery;+import com.pmease.gitplex.search.query.TooGeneralQueryException;public interface SearchManager extends IndexListener {-- List<QueryHit> search(Repository repository, String revision, BlobQuery query) throws InterruptedException;++ /**+ * Search specified repository with specified revision and query.+ *+ * @return+ * list of sorted query results, with most relevant result coming first+ * @throws+ * TooGeneralQueryException if supplied query term is too general to possibly cause query slow+ * InterruptedException if the search process is interrupted+ */+ List<QueryHit> search(Repository repository, String revision, BlobQuery query)+ throws InterruptedException, TooGeneralQueryException;}diff --git a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/BlobQuery.java b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/BlobQuery.javaindex 3bc5d72b90..b2cbbe0ab8 100644--- a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/BlobQuery.java+++ b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/BlobQuery.java@@ -20,7 +20,7 @@ public abstract class BlobQuery {private final String fieldName;- private final String searchFor;+ private final String term;private final int count;@@ -36,12 +36,12 @@ public abstract class BlobQuery {private transient Pattern pattern;- private transient String casedSearchFor;+ private transient String casedTerm;- public BlobQuery(String fieldName, String searchFor, boolean regex, boolean wordMatch, boolean caseSensitive,+ public BlobQuery(String fieldName, String term, boolean regex, boolean wordMatch, boolean caseSensitive,@Nullable String pathPrefix, @Nullable Collection<String> pathSuffixes, int count) {this.fieldName = fieldName;- this.searchFor = searchFor;+ this.term = term;this.regex = regex;this.wordMatch = wordMatch;this.caseSensitive = caseSensitive;@@ -54,8 +54,8 @@ public abstract class BlobQuery {return fieldName;}- public String getSearchFor() {- return searchFor;+ public String getTerm() {+ return term;}public int getCount() {@@ -84,11 +84,17 @@ public abstract class BlobQuery {public abstract void collect(TreeWalk treeWalk, List<QueryHit> hits);- public Query asLuceneQuery() {+ /**+ * Get lucene query representation of this query+ *+ * @return+ * lucene query+ * @throws+ * TooGeneralQueryException if supplied query term is too general to possibly cause query slow+ */+ public Query asLuceneQuery() throws TooGeneralQueryException {BooleanQuery query = new BooleanQuery(true);- Query searchForQuery = getLuceneQueryOfSearchFor();- if (searchForQuery != null)- query.add(searchForQuery, Occur.MUST);+ query.add(asLuceneQuery(getTerm()), Occur.MUST);if (pathPrefix != null)query.add(new WildcardQuery(BLOB_PATH.term(pathPrefix + "*")), Occur.MUST);@@ -105,13 +111,20 @@ public abstract class BlobQuery {return new WildcardQuery(BLOB_PATH.term("*"));}- @Nullable- protected abstract Query getLuceneQueryOfSearchFor();+ /**+ * Get lucene query representation of the search term+ *+ * @return+ * lucene query+ * @throws+ * TooGeneralQueryException if supplied query term is too general to possibly cause query slow+ */+ protected abstract Query asLuceneQuery(String term) throws TooGeneralQueryException;protected Pattern getPattern() {if (regex) {if (pattern == null) {- String expression = getSearchFor();+ String expression = getTerm();if (isWordMatch()) {if (!expression.startsWith("\\b"))expression = "\\b" + expression;@@ -129,14 +142,14 @@ public abstract class BlobQuery {}}- protected String getCasedSearchFor() {- if (casedSearchFor == null) {+ protected String getCasedTerm() {+ if (casedTerm == null) {if (caseSensitive)- casedSearchFor = searchFor;+ casedTerm = term;else- casedSearchFor = searchFor.toLowerCase();+ casedTerm = term.toLowerCase();}- return casedSearchFor;+ return casedTerm;}protected String getCasedText(String text) {diff --git a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/SymbolQuery.java b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/SymbolQuery.javaindex 6e7abe125e..dca67b4150 100644--- a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/SymbolQuery.java+++ b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/SymbolQuery.java@@ -35,14 +35,14 @@ public class SymbolQuery extends BlobQuery {private static final Logger logger = LoggerFactory.getLogger(SymbolQuery.class);- public SymbolQuery(String searchFor, boolean regex, boolean exactMatch, boolean caseSensitive,+ public SymbolQuery(String term, boolean regex, boolean exactMatch, boolean caseSensitive,@Nullable String pathPrefix, Collection<String> pathSuffixes, int count) {- super(FieldConstants.BLOB_SYMBOLS.name(), searchFor, regex, exactMatch,+ super(FieldConstants.BLOB_SYMBOLS.name(), term, regex, exactMatch,caseSensitive, pathPrefix, pathSuffixes, count);}- public SymbolQuery(String searchFor, boolean regex, boolean exactMatch, boolean caseSensitive, int count) {- this(searchFor, regex, exactMatch, caseSensitive, null, null, count);+ public SymbolQuery(String term, boolean regex, boolean exactMatch, boolean caseSensitive, int count) {+ this(term, regex, exactMatch, caseSensitive, null, null, count);}@Override@@ -97,7 +97,7 @@ public class SymbolQuery extends BlobQuery {private boolean matches(String text) {Pattern pattern = getPattern();- String searchFor = getCasedSearchFor();+ String searchFor = getCasedTerm();if (pattern != null) {return pattern.matcher(text).find();} else {@@ -110,17 +110,20 @@ public class SymbolQuery extends BlobQuery {}@Override- protected Query getLuceneQueryOfSearchFor() {+ protected Query asLuceneQuery(String term) {if (isRegex()) {- return new RegexLiterals(getSearchFor()).asWildcardQuery(getFieldName());- } else if (getSearchFor().length() != 0) {- if (isWordMatch())- return new TermQuery(new Term(getFieldName(), getSearchFor().toLowerCase()));- else- return new WildcardQuery(new Term(getFieldName(), getSearchFor().toLowerCase() + "*"));+ return new RegexLiterals(term).asWildcardQuery(getFieldName());} else {- return null;- }+ term = StringUtils.replaceChars(term, "*?", "");+ if (StringUtils.isNotBlank(term)) {+ if (isWordMatch())+ return new TermQuery(new Term(getFieldName(), term.toLowerCase()));+ else+ return new WildcardQuery(new Term(getFieldName(), term.toLowerCase() + "*"));+ } else {+ throw new TooGeneralQueryException();+ }+ }}}diff --git a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/TextQuery.java b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/TextQuery.javaindex 31c512a67a..0c0267a2a3 100644--- a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/TextQuery.java+++ b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/TextQuery.java@@ -30,14 +30,14 @@ public class TextQuery extends BlobQuery {private static int MAX_LINE_LEN = 1024;- public TextQuery(String searchFor, boolean regex, boolean matchWord, boolean caseSensitive,+ public TextQuery(String term, boolean regex, boolean matchWord, boolean caseSensitive,@Nullable String pathPrefix, @Nullable Collection<String> pathSuffixes, int count) {- super(FieldConstants.BLOB_TEXT.name(), searchFor, regex, matchWord, caseSensitive,+ super(FieldConstants.BLOB_TEXT.name(), term, regex, matchWord, caseSensitive,pathPrefix, pathSuffixes, count);}- public TextQuery(String searchFor, boolean regex, boolean matchWord, boolean caseSensitive, int count) {- this(searchFor, regex, matchWord, caseSensitive, null, null, count);+ public TextQuery(String term, boolean regex, boolean matchWord, boolean caseSensitive, int count) {+ this(term, regex, matchWord, caseSensitive, null, null, count);}@Override@@ -70,14 +70,14 @@ public class TextQuery extends BlobQuery {lineNo++;}} else {- String searchFor = getCasedSearchFor();+ String casedTerm = getCasedTerm();int lineNo = 0;for (String line: Splitter.on("\n").split(content)) {String casedLine = getCasedText(line);- int start = casedLine.indexOf(searchFor, 0);+ int start = casedLine.indexOf(casedTerm, 0);while (start != -1) {- int end = start + searchFor.length();+ int end = start + casedTerm.length();if (isWordMatch()) {char beforeChar;if (start == 0)@@ -103,7 +103,7 @@ public class TextQuery extends BlobQuery {if (hits.size() >= getCount())break;}- start = casedLine.indexOf(searchFor, end);+ start = casedLine.indexOf(casedTerm, end);}if (hits.size() >= getCount())break;@@ -122,13 +122,13 @@ public class TextQuery extends BlobQuery {}@Override- protected Query getLuceneQueryOfSearchFor() {+ protected Query asLuceneQuery(String term) {if (isRegex())- return new RegexLiterals(getSearchFor()).asNGramQuery(getFieldName(), NGRAM_SIZE);- else if (getSearchFor().length() >= NGRAM_SIZE)- return new NGramLuceneQuery(getFieldName(), getSearchFor(), NGRAM_SIZE);+ return new RegexLiterals(term).asNGramQuery(getFieldName(), NGRAM_SIZE);+ else if (term.length() >= NGRAM_SIZE)+ return new NGramLuceneQuery(getFieldName(), term, NGRAM_SIZE);else- return null;+ throw new TooGeneralQueryException();}}diff --git a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/TooGeneralQueryException.java b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/TooGeneralQueryException.javanew file mode 100644index 0000000000..3c2eb2f13e--- /dev/null+++ b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/TooGeneralQueryException.java@@ -0,0 +1,7 @@+package com.pmease.gitplex.search.query;++public class TooGeneralQueryException extends RuntimeException {++ private static final long serialVersionUID = 1L;++}diff --git a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/regex/RegexLiterals.java b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/regex/RegexLiterals.javaindex 1b6d3c8e24..c5005de447 100644--- a/gitplex.search/src/main/java/com/pmease/gitplex/search/query/regex/RegexLiterals.java+++ b/gitplex.search/src/main/java/com/pmease/gitplex/search/query/regex/RegexLiterals.java@@ -4,8 +4,6 @@ import static com.pmease.gitplex.search.IndexConstants.NGRAM_SIZE;import java.util.List;-import javax.annotation.Nullable;-import org.antlr.v4.runtime.ANTLRInputStream;import org.antlr.v4.runtime.CommonTokenStream;import org.apache.lucene.index.Term;@@ -16,6 +14,7 @@ import org.apache.lucene.search.WildcardQuery;import com.google.common.base.Strings;import com.pmease.gitplex.search.query.NGramLuceneQuery;+import com.pmease.gitplex.search.query.TooGeneralQueryException;public class RegexLiterals {@@ -29,9 +28,14 @@ public class RegexLiterals {OrLiterals orLiterals = (OrLiterals) new LiteralVisitor().visit(new PCREParser(tokens).parse());rows = orLiterals.flattern(true);}-- @Nullable- public Query asNGramQuery(String fieldName, int gramSize) {++ /**+ * @param fieldName+ * @param gramSize+ * @return+ * @throws TooGeneralQueryException+ */+ public Query asNGramQuery(String fieldName, int gramSize) throws TooGeneralQueryException {BooleanQuery orQuery = new BooleanQuery();for (List<LeafLiterals> row: rows) {BooleanQuery andQuery = new BooleanQuery();@@ -45,11 +49,15 @@ public class RegexLiterals {if (orQuery.getClauses().length != 0)return orQuery;else- return null;+ throw new TooGeneralQueryException();}- @Nullable- public Query asWildcardQuery(String fieldName) {+ /**+ * @param fieldName+ * @return+ * @throws TooGeneralQueryException+ */+ public Query asWildcardQuery(String fieldName) throws TooGeneralQueryException {BooleanQuery orQuery = new BooleanQuery();for (List<LeafLiterals> row: rows) {BooleanQuery andQuery = new BooleanQuery();@@ -63,7 +71,7 @@ public class RegexLiterals {if (orQuery.getClauses().length != 0)return orQuery;else- return null;+ throw new TooGeneralQueryException();}@Overridediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/blobsearch/BlobSearchPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/blobsearch/BlobSearchPanel.javaindex a167fe916c..576bb8c8e2 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/blobsearch/BlobSearchPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/blobsearch/BlobSearchPanel.java@@ -43,7 +43,7 @@ import org.apache.wicket.request.resource.ResourceReference;import com.google.common.base.CharMatcher;import com.google.common.base.Splitter;-import com.google.common.base.Strings;+import com.pmease.commons.util.StringUtils;import com.pmease.commons.wicket.AjaxEvent;import com.pmease.commons.wicket.assets.hotkeys.HotkeysResourceReference;import com.pmease.commons.wicket.behavior.RunTaskBehavior;@@ -60,13 +60,17 @@ import com.pmease.gitplex.search.hit.QueryHit;import com.pmease.gitplex.search.query.BlobQuery;import com.pmease.gitplex.search.query.SymbolQuery;import com.pmease.gitplex.search.query.TextQuery;+import com.pmease.gitplex.search.query.TooGeneralQueryException;+import com.pmease.gitplex.web.page.repository.file.SearchResultPanel;@SuppressWarnings("serial")public abstract class BlobSearchPanel extends Panel {- private static final int MAX_INSTANT_QUERY_ENTRIES = 15;+ private static final int SYMBOL_QUERY_ENTRIES = 1000;- public static final int MAX_ADVANCED_QUERY_ENTRIES = 1000;+ private static final int SYMBOL_DISPLAY_ENTRIES = 15;++ private static final int TEXT_QUERY_ENTRIES = 15;private final IModel<Repository> repoModel;@@ -161,11 +165,14 @@ public abstract class BlobSearchPanel extends Panel {@Overrideprotected void runTask(AjaxRequestTarget target) {SymbolQuery query = new SymbolQuery(- instantSearchInput, false, false, false, MAX_ADVANCED_QUERY_ENTRIES);+ instantSearchInput, false, false, false, SearchResultPanel.MAX_QUERY_ENTRIES);try {SearchManager searchManager = GitPlex.getInstance(SearchManager.class);List<QueryHit> hits = searchManager.search(repoModel.getObject(), revisionModel.getObject(), query);renderQueryHits(target, hits);+ } catch (TooGeneralQueryException e) {+ // this is impossible as we already queried part of the result+ throw new IllegalStateException();} catch (InterruptedException e) {throw new RuntimeException(e);}@@ -178,7 +185,7 @@ public abstract class BlobSearchPanel extends Panel {@Overrideprotected void onConfigure() {super.onConfigure();- setVisible(symbolHits.size()==MAX_INSTANT_QUERY_ENTRIES);+ setVisible(symbolHits.size()==SYMBOL_DISPLAY_ENTRIES);}@Override@@ -260,11 +267,14 @@ public abstract class BlobSearchPanel extends Panel {@Overrideprotected void runTask(AjaxRequestTarget target) {TextQuery query = new TextQuery(- instantSearchInput, false, false, false, MAX_ADVANCED_QUERY_ENTRIES);+ instantSearchInput, false, false, false, SearchResultPanel.MAX_QUERY_ENTRIES);try {SearchManager searchManager = GitPlex.getInstance(SearchManager.class);List<QueryHit> hits = searchManager.search(repoModel.getObject(), revisionModel.getObject(), query);renderQueryHits(target, hits);+ } catch (TooGeneralQueryException e) {+ // this is impossible as we already queried part of the result+ throw new IllegalStateException();} catch (InterruptedException e) {throw new RuntimeException(e);}@@ -277,7 +287,7 @@ public abstract class BlobSearchPanel extends Panel {@Overrideprotected void onConfigure() {super.onConfigure();- setVisible(textHits.size()==MAX_INSTANT_QUERY_ENTRIES);+ setVisible(textHits.size()==TEXT_QUERY_ENTRIES);}@Override@@ -311,22 +321,28 @@ public abstract class BlobSearchPanel extends Panel {target.add(instantSearchResult);instantSearchInput = instantSearchField.getInput();- if (!Strings.isNullOrEmpty(instantSearchInput)) {+ if (StringUtils.isNotBlank(instantSearchInput)) {SearchManager searchManager = GitPlex.getInstance(SearchManager.class);- BlobQuery blobQuery = new SymbolQuery(instantSearchField.getInput(),- false, false, false, MAX_INSTANT_QUERY_ENTRIES);+ BlobQuery blobQuery = new SymbolQuery(instantSearchInput, false, false, false, SYMBOL_QUERY_ENTRIES);+try {symbolHits = searchManager.search(repoModel.getObject(), revisionModel.getObject(), blobQuery);+ } catch (TooGeneralQueryException e) {+ symbolHits = new ArrayList<>();} catch (InterruptedException e) {throw new RuntimeException(e);}++ if (symbolHits.size() > SYMBOL_DISPLAY_ENTRIES)+ symbolHits = new ArrayList<>(symbolHits.subList(0, SYMBOL_DISPLAY_ENTRIES));if (instantSearchInput.length() >= IndexConstants.NGRAM_SIZE) {- TextQuery textQuery = new TextQuery(instantSearchField.getInput(),- false, false, false, MAX_INSTANT_QUERY_ENTRIES);+ TextQuery textQuery = new TextQuery(instantSearchInput, false, false, false, TEXT_QUERY_ENTRIES);try {textHits = searchManager.search(repoModel.getObject(), revisionModel.getObject(), textQuery);+ } catch (TooGeneralQueryException e) {+ symbolHits = new ArrayList<>();} catch (InterruptedException e) {throw new RuntimeException(e);}@@ -403,10 +419,10 @@ public abstract class BlobSearchPanel extends Panel {private QueryHit getActiveHit() {List<QueryHit> hits = new ArrayList<>();hits.addAll(symbolHits);- if (symbolHits.size() == MAX_INSTANT_QUERY_ENTRIES)+ if (symbolHits.size() == SYMBOL_DISPLAY_ENTRIES)hits.add(new MoreSymbolHit());hits.addAll(textHits);- if (textHits.size() == MAX_INSTANT_QUERY_ENTRIES)+ if (textHits.size() == TEXT_QUERY_ENTRIES)hits.add(new MoreTextHit());if (activeHitIndex >=0 && activeHitIndex<hits.size())@@ -468,7 +484,7 @@ public abstract class BlobSearchPanel extends Panel {@Overrideprotected Component newContent(String id, ModalBehavior behavior) {Fragment fragment = new Fragment(id, "advancedSearchFrag", BlobSearchPanel.this);- Form<?> form = new Form<Void>("form");+ final Form<?> form = new Form<Void>("form");form.setOutputMarkupId(true);fragment.add(form);@@ -549,21 +565,23 @@ public abstract class BlobSearchPanel extends Panel {BlobQuery query;if (searchType.equals(SEARCH_SYMBOLS)) {query = new SymbolQuery(searchFor, regex, wholeWord, caseSensitive,- null, pathSuffixes, MAX_ADVANCED_QUERY_ENTRIES);+ null, pathSuffixes, SearchResultPanel.MAX_QUERY_ENTRIES);} else {query = new TextQuery(searchFor, regex, wholeWord, caseSensitive,- null, pathSuffixes, MAX_ADVANCED_QUERY_ENTRIES);+ null, pathSuffixes, SearchResultPanel.MAX_QUERY_ENTRIES);}-+try {SearchManager searchManager = GitPlex.getInstance(SearchManager.class);List<QueryHit> hits = searchManager.search(repoModel.getObject(), revisionModel.getObject(), query);renderQueryHits(target, hits);+ close(target);+ } catch (TooGeneralQueryException e) {+ searchForInput.error("Query term is too general.");+ target.add(form);} catch (InterruptedException e) {throw new RuntimeException(e);}-- close(target);}});diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/RepoFilePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/RepoFilePage.javaindex 81a07d77ef..237a9436f3 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/RepoFilePage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/RepoFilePage.java@@ -331,7 +331,7 @@ public class RepoFilePage extends RepositoryPage {};} else {- fileViewer = new BlobViewContext(file) {+ fileViewer = new BlobViewContext(new BlobIdent(file)) {@Overridepublic Repository getRepository() {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/SearchResultPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/SearchResultPanel.javaindex 8a42cae268..2278c11a77 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/SearchResultPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/file/SearchResultPanel.java@@ -22,11 +22,12 @@ import com.pmease.gitplex.search.hit.FileHit;import com.pmease.gitplex.search.hit.MatchedBlob;import com.pmease.gitplex.search.hit.QueryHit;import com.pmease.gitplex.search.hit.TextHit;-import com.pmease.gitplex.web.component.blobsearch.BlobSearchPanel;@SuppressWarnings("serial")-abstract class SearchResultPanel extends Panel {+public abstract class SearchResultPanel extends Panel {+ public static final int MAX_QUERY_ENTRIES = 1000;+private enum ExpandStatus {EXPAND_ALL, COLLAPSE_ALL};private static final String HITS_ID = "hits";@@ -34,11 +35,11 @@ abstract class SearchResultPanel extends Panel {private final List<MatchedBlob> blobs;private final boolean hasMore;-+public SearchResultPanel(String id, List<QueryHit> hits) {super(id);- hasMore = (hits.size() == BlobSearchPanel.MAX_ADVANCED_QUERY_ENTRIES);+ hasMore = (hits.size() == SearchResultPanel.MAX_QUERY_ENTRIES);Map<String, MatchedBlob> hitsByBlob = new LinkedHashMap<>();@@ -59,7 +60,7 @@ abstract class SearchResultPanel extends Panel {protected void onInitialize() {super.onInitialize();- String message = "too many matches, displaying " + BlobSearchPanel.MAX_ADVANCED_QUERY_ENTRIES + " of them";+ String message = "too many matches, displaying " + MAX_QUERY_ENTRIES + " of them";add(new Label("hasMoreMessage", message).setVisible(hasMore));add(new AjaxLink<Void>("prevMatch") {