# SINCE 0.8.0\r
groovy.postReceiveScripts =\r
\r
-# If true, a Lucene index will be generated and maintained for each repository.\r
-# Lucene search replaces brute-force Git repository traversal. Initial indexing\r
-# or reindexing of a repository can be memory intensive so be advised that you\r
-# may need to adjust your JVM heap setting accordingly (e.g. -Xmx1024M)\r
-#\r
-# SINCE 0.9.0\r
-# RESTART REQUIRED\r
-lucene.enable = false\r
-\r
-# This value specifies the idle period for the Lucene executor to wait between\r
-# repository ref checks. If refs have been changed since the last check, the\r
-# executor will incrementally index the changes.\r
-#\r
-# Gitblit will check all repositories for branch updates 1 minute after startup.\r
-# Indexes will automatically be built for any repository that is missing its index\r
-# or if an index version change is detected.\r
-#\r
-# The shortest frequency allowed is every 2 minutes\r
-# Decimal frequency values are cast to integers\r
-# Frequency values may be specified in mins, hours, or days\r
-#\r
-# SINCE 0.9.0\r
-# RESTART REQUIRED\r
-lucene.frequency = 2 mins\r
-\r
#\r
# Authentication Settings\r
#\r
import com.gitblit.utils.MetricUtils;\r
import com.gitblit.utils.ObjectCache;\r
import com.gitblit.utils.StringUtils;\r
-import com.gitblit.utils.TimeUtils;\r
\r
/**\r
* GitBlit is the servlet context listener singleton that acts as the core for\r
// create repository\r
logger.info("create repository " + repository.name);\r
r = JGitUtils.createRepository(repositoriesFolder, repository.name);\r
- \r
- // automatically index master branch if Lucene integration is enabled\r
- if (luceneExecutor.isReady()) {\r
- repository.indexedBranches = new ArrayList<String>();\r
- repository.indexedBranches.add("refs/heads/master");\r
- }\r
} else {\r
// rename repository\r
if (!repositoryName.equalsIgnoreCase(repository.name)) {\r
logger.warn("Mail server is not properly configured. Mail services disabled.");\r
}\r
luceneExecutor = new LuceneExecutor(settings, repositoriesFolder);\r
- if (luceneExecutor.isReady()) {\r
- String idle = settings.getString(Keys.lucene.frequency, "2 mins");\r
- int mins = TimeUtils.convertFrequencyToMinutes(idle);\r
- if (mins <= 2) {\r
- mins = 2;\r
- idle = mins + " mins";\r
- }\r
- logger.info("Lucene executor is scheduled to process ref changes every " + idle);\r
- scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, mins, TimeUnit.MINUTES);\r
- } else {\r
- logger.warn("Lucene integration is disabled.");\r
- }\r
+ logger.info("Lucene executor is scheduled to process indexed branches every 2 minutes.");\r
+ scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, 2, TimeUnit.MINUTES);\r
if (startFederation) {\r
configureFederation();\r
} \r
}\r
\r
/**\r
- * Indicates if the Lucene executor can index repositories.\r
- * \r
- * @return true if the Lucene executor is ready to index repositories\r
- */\r
- public boolean isReady() {\r
- return storedSettings.getBoolean(Keys.lucene.enable, false);\r
- }\r
-\r
- /**\r
- * Run is executed by the gitblit executor service at whatever frequency\r
- * is specified in the settings. Because this is called by an executor\r
- * service, calls will queue - i.e. there can never be concurrent execution\r
- * of repository index updates.\r
+ * Run is executed by the Gitblit executor service. Because this is called \r
+ * by an executor service, calls will queue - i.e. there can never be\r
+ * concurrent execution of repository index updates.\r
*/\r
@Override\r
public void run() {\r
- if (!isReady()) {\r
- return;\r
- }\r
-\r
for (String repositoryName: GitBlit.self().getRepositoryList()) {\r
RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);\r
if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {\r
pages.add(new PageRegistration("gb.repositories", RepositoriesPage.class,\r
getRootPageParameters()));\r
pages.add(new PageRegistration("gb.activity", ActivityPage.class, getRootPageParameters()));\r
- if (GitBlit.getBoolean(Keys.lucene.enable, false)) {\r
- pages.add(new PageRegistration("gb.search", LuceneSearchPage.class));\r
- }\r
+ pages.add(new PageRegistration("gb.search", LuceneSearchPage.class));\r
if (showAdmin) {\r
pages.add(new PageRegistration("gb.users", UsersPage.class));\r
}\r