瀏覽代碼

Eliminated Lucene settings

tags/v0.9.0
James Moger 12 年之前
父節點
當前提交
273cb90146

+ 0
- 25
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
#

+ 2
- 19
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<String>();
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();
}

+ 3
- 17
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)) {

+ 1
- 3
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));
}

Loading…
取消
儲存