From c20191fc0931a19bec0df1ab2b56f287e5d8b7c7 Mon Sep 17 00:00:00 2001
From: Joel Johnson <joel.johnson@issinc.com>
Date: Fri, 12 Jun 2015 19:46:31 -0400
Subject: [PATCH] allow configuring of internal URLs offered
---
src/main/java/com/gitblit/service/LuceneService.java | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/gitblit/service/LuceneService.java b/src/main/java/com/gitblit/service/LuceneService.java
index 70e3b24..798edb0 100644
--- a/src/main/java/com/gitblit/service/LuceneService.java
+++ b/src/main/java/com/gitblit/service/LuceneService.java
@@ -105,7 +105,7 @@
public class LuceneService implements Runnable {
- private static final int INDEX_VERSION = 5;
+ private static final int INDEX_VERSION = 6;
private static final String FIELD_OBJECT_TYPE = "type";
private static final String FIELD_PATH = "path";
@@ -125,7 +125,7 @@
private static final String CONF_ALIAS = "aliases";
private static final String CONF_BRANCH = "branches";
- private static final Version LUCENE_VERSION = Version.LUCENE_46;
+ private static final Version LUCENE_VERSION = Version.LUCENE_4_10_0;
private final Logger logger = LoggerFactory.getLogger(LuceneService.class);
@@ -194,7 +194,7 @@
* Synchronously indexes a repository. This may build a complete index of a
* repository or it may update an existing index.
*
- * @param name
+ * @param displayName
* the name of the repository
* @param repository
* the repository object
@@ -437,7 +437,7 @@
// skip non-annotated tags
continue;
}
- if (!tags.containsKey(tag.getObjectId())) {
+ if (!tags.containsKey(tag.getObjectId().getName())) {
tags.put(tag.getReferencedObjectId().getName(), new ArrayList<String>());
}
tags.get(tag.getReferencedObjectId().getName()).add(tag.displayName);
@@ -476,8 +476,8 @@
&& branch.equals(defaultBranch)) {
// indexing "default" branch
indexBranch = true;
- } else if (branch.getName().startsWith(com.gitblit.Constants.R_GITBLIT)) {
- // skip Gitblit internal branches
+ } else if (branch.getName().startsWith(com.gitblit.Constants.R_META)) {
+ // skip internal meta branches
indexBranch = false;
} else {
// normal explicit branch check
@@ -760,7 +760,7 @@
// skip non-annotated tags
continue;
}
- if (!tags.containsKey(tag.getObjectId())) {
+ if (!tags.containsKey(tag.getObjectId().getName())) {
tags.put(tag.getReferencedObjectId().getName(), new ArrayList<String>());
}
tags.get(tag.getReferencedObjectId().getName()).add(tag.displayName);
@@ -807,8 +807,8 @@
&& branch.equals(defaultBranch)) {
// indexing "default" branch
indexBranch = true;
- } else if (branch.getName().startsWith(com.gitblit.Constants.R_GITBLIT)) {
- // ignore internal Gitblit branches
+ } else if (branch.getName().startsWith(com.gitblit.Constants.R_META)) {
+ // ignore internal meta branches
indexBranch = false;
} else {
// normal explicit branch check
@@ -1104,6 +1104,7 @@
content = "";
}
+ int tabLength = storedSettings.getInteger(Keys.web.tabLength, 4);
int fragmentLength = SearchObjectType.commit == result.type ? 512 : 150;
QueryScorer scorer = new QueryScorer(query, "content");
@@ -1126,7 +1127,7 @@
if (fragment.length() > fragmentLength) {
fragment = fragment.substring(0, fragmentLength) + "...";
}
- return "<pre class=\"text\">" + StringUtils.escapeForHtml(fragment, true) + "</pre>";
+ return "<pre class=\"text\">" + StringUtils.escapeForHtml(fragment, true, tabLength) + "</pre>";
}
// make sure we have unique fragments
--
Gitblit v1.9.1