From 934ada531b4cf78b76f5b458190c1f057ff770c9 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Mon, 12 Mar 2012 20:52:34 -0400
Subject: [PATCH] Revised reindex method per JGit team recommendation

---
 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 4f06b4e..c9e4c73 100644
--- a/src/com/gitblit/LuceneExecutor.java
+++ b/src/com/gitblit/LuceneExecutor.java
@@ -121,6 +121,7 @@
 					}
 					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 @@
 				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 {

--
Gitblit v1.9.1