From: James Moger Date: Tue, 20 Mar 2012 02:25:22 +0000 (-0400) Subject: Eliminated Lucene settings X-Git-Tag: v0.9.0~45 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=273cb9014658ee5f931a191e3a2f6065d7c2657f;p=gitblit.git Eliminated Lucene settings --- diff --git a/distrib/gitblit.properties b/distrib/gitblit.properties index 18eafca9..2ac6598f 100644 --- a/distrib/gitblit.properties +++ b/distrib/gitblit.properties @@ -91,31 +91,6 @@ groovy.preReceiveScripts = # SINCE 0.8.0 groovy.postReceiveScripts = -# If true, a Lucene index will be generated and maintained for each repository. -# Lucene search replaces brute-force Git repository traversal. Initial indexing -# or reindexing of a repository can be memory intensive so be advised that you -# may need to adjust your JVM heap setting accordingly (e.g. -Xmx1024M) -# -# SINCE 0.9.0 -# RESTART REQUIRED -lucene.enable = false - -# This value specifies the idle period for the Lucene executor to wait between -# repository ref checks. If refs have been changed since the last check, the -# executor will incrementally index the changes. -# -# Gitblit will check all repositories for branch updates 1 minute after startup. -# Indexes will automatically be built for any repository that is missing its index -# or if an index version change is detected. -# -# The shortest frequency allowed is every 2 minutes -# Decimal frequency values are cast to integers -# Frequency values may be specified in mins, hours, or days -# -# SINCE 0.9.0 -# RESTART REQUIRED -lucene.frequency = 2 mins - # # Authentication Settings # diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java index b2e53d67..7b557d79 100644 --- a/src/com/gitblit/GitBlit.java +++ b/src/com/gitblit/GitBlit.java @@ -87,7 +87,6 @@ import com.gitblit.utils.JsonUtils; import com.gitblit.utils.MetricUtils; import com.gitblit.utils.ObjectCache; import com.gitblit.utils.StringUtils; -import com.gitblit.utils.TimeUtils; /** * GitBlit is the servlet context listener singleton that acts as the core for @@ -957,12 +956,6 @@ public class GitBlit implements ServletContextListener { // create repository logger.info("create repository " + repository.name); r = JGitUtils.createRepository(repositoriesFolder, repository.name); - - // automatically index master branch if Lucene integration is enabled - if (luceneExecutor.isReady()) { - repository.indexedBranches = new ArrayList(); - repository.indexedBranches.add("refs/heads/master"); - } } else { // rename repository if (!repositoryName.equalsIgnoreCase(repository.name)) { @@ -1845,18 +1838,8 @@ public class GitBlit implements ServletContextListener { logger.warn("Mail server is not properly configured. Mail services disabled."); } luceneExecutor = new LuceneExecutor(settings, repositoriesFolder); - if (luceneExecutor.isReady()) { - String idle = settings.getString(Keys.lucene.frequency, "2 mins"); - int mins = TimeUtils.convertFrequencyToMinutes(idle); - if (mins <= 2) { - mins = 2; - idle = mins + " mins"; - } - logger.info("Lucene executor is scheduled to process ref changes every " + idle); - scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, mins, TimeUnit.MINUTES); - } else { - logger.warn("Lucene integration is disabled."); - } + logger.info("Lucene executor is scheduled to process indexed branches every 2 minutes."); + scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, 2, TimeUnit.MINUTES); if (startFederation) { configureFederation(); } diff --git a/src/com/gitblit/LuceneExecutor.java b/src/com/gitblit/LuceneExecutor.java index e859947d..db604a0a 100644 --- a/src/com/gitblit/LuceneExecutor.java +++ b/src/com/gitblit/LuceneExecutor.java @@ -148,26 +148,12 @@ public class LuceneExecutor implements Runnable { } /** - * Indicates if the Lucene executor can index repositories. - * - * @return true if the Lucene executor is ready to index repositories - */ - public boolean isReady() { - return storedSettings.getBoolean(Keys.lucene.enable, false); - } - - /** - * Run is executed by the gitblit executor service at whatever frequency - * is specified in the settings. Because this is called by an executor - * service, calls will queue - i.e. there can never be concurrent execution - * of repository index updates. + * Run is executed by the Gitblit executor service. Because this is called + * by an executor service, calls will queue - i.e. there can never be + * concurrent execution of repository index updates. */ @Override public void run() { - if (!isReady()) { - return; - } - for (String repositoryName: GitBlit.self().getRepositoryList()) { RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName); if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) { diff --git a/src/com/gitblit/wicket/pages/RootPage.java b/src/com/gitblit/wicket/pages/RootPage.java index f110cb31..bf811f94 100644 --- a/src/com/gitblit/wicket/pages/RootPage.java +++ b/src/com/gitblit/wicket/pages/RootPage.java @@ -101,9 +101,7 @@ public abstract class RootPage extends BasePage { pages.add(new PageRegistration("gb.repositories", RepositoriesPage.class, getRootPageParameters())); pages.add(new PageRegistration("gb.activity", ActivityPage.class, getRootPageParameters())); - if (GitBlit.getBoolean(Keys.lucene.enable, false)) { - pages.add(new PageRegistration("gb.search", LuceneSearchPage.class)); - } + pages.add(new PageRegistration("gb.search", LuceneSearchPage.class)); if (showAdmin) { pages.add(new PageRegistration("gb.users", UsersPage.class)); }