diff options
author | James Moger <james.moger@gitblit.com> | 2012-03-12 20:52:34 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-03-12 20:52:34 -0400 |
commit | 934ada531b4cf78b76f5b458190c1f057ff770c9 (patch) | |
tree | f174ef532e0c98ac8aa55c8b5ffe5fb6c182f1ed /src/com/gitblit/LuceneExecutor.java | |
parent | 9e2f9ddbe46e88c919834940352dcead61ac7a02 (diff) | |
download | gitblit-934ada531b4cf78b76f5b458190c1f057ff770c9.tar.gz gitblit-934ada531b4cf78b76f5b458190c1f057ff770c9.zip |
Revised reindex method per JGit team recommendation
Diffstat (limited to 'src/com/gitblit/LuceneExecutor.java')
-rw-r--r-- | src/com/gitblit/LuceneExecutor.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/com/gitblit/LuceneExecutor.java b/src/com/gitblit/LuceneExecutor.java index 4f06b4ec..c9e4c73e 100644 --- a/src/com/gitblit/LuceneExecutor.java +++ b/src/com/gitblit/LuceneExecutor.java @@ -121,6 +121,7 @@ public class LuceneExecutor implements Runnable { }
index(name, repository);
repository.close();
+ System.gc();
processed.add(name);
} catch (Throwable e) {
logger.error(MessageFormat.format("Failed to update {0} Lucene index",
@@ -145,18 +146,16 @@ public class LuceneExecutor implements Runnable { if (LuceneUtils.shouldReindex(repository)) {
// (re)build the entire index
long start = System.currentTimeMillis();
- String msg = "Building {0} Lucene index...";
- logger.info(MessageFormat.format(msg, name));
- IndexResult result = LuceneUtils.reindex(name, repository, true);
+ IndexResult result = LuceneUtils.reindex(name, repository);
float duration = (System.currentTimeMillis() - start)/1000f;
if (result.success) {
if (result.commitCount > 0) {
- msg = "Built {0} Lucene index from {1} commits and {2} files across {3} branches in {4} secs";
+ String msg = "Built {0} Lucene index from {1} commits and {2} files across {3} branches in {4} secs";
logger.info(MessageFormat.format(msg, name,
result.commitCount, result.blobCount, result.branchCount, duration));
}
} else {
- msg = "Could not build {0} Lucene index!";
+ String msg = "Could not build {0} Lucene index!";
logger.error(MessageFormat.format(msg, name));
}
} else {
|