Eliminated Lucene settings
| | |
| | | # 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
|
| | | #
|
| | |
| | | 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
|
| | |
| | | // 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<String>();
|
| | | repository.indexedBranches.add("refs/heads/master");
|
| | | }
|
| | | } else {
|
| | | // rename repository
|
| | | if (!repositoryName.equalsIgnoreCase(repository.name)) {
|
| | |
| | | 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();
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 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)) {
|
| | |
| | | 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));
|
| | | }
|