| | |
| | | String exts = storedSettings.getString(Keys.web.luceneIgnoreExtensions, luceneIgnoreExtensions);
|
| | | excludedExtensions = new TreeSet<String>(StringUtils.getStringsFromValue(exts));
|
| | |
|
| | | if (GitBlit.self().isCollectingGarbage()) {
|
| | | // busy collecting garbage, try again later
|
| | | return;
|
| | | }
|
| | | |
| | | for (String repositoryName: GitBlit.self().getRepositoryList()) {
|
| | | RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
|
| | | if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {
|
| | | Repository repository = GitBlit.self().getRepository(model.name);
|
| | | if (repository == null) {
|
| | | if (GitBlit.self().isCollectingGarbage(model.name)) {
|
| | | logger.info(MessageFormat.format("Skipping Lucene index of {0}, busy garbage collecting", repositoryName));
|
| | | }
|
| | | continue;
|
| | | }
|
| | | index(model, repository);
|
| | | repository.close();
|
| | | System.gc();
|
| | |
| | | close(repositoryName);
|
| | |
|
| | | // delete the index folder
|
| | | File repositoryFolder = new File(repositoriesFolder, repositoryName);
|
| | | File repositoryFolder = FileKey.resolve(new File(repositoriesFolder, repositoryName), FS.DETECTED);
|
| | | File luceneIndex = new File(repositoryFolder, LUCENE_DIR);
|
| | | if (luceneIndex.exists()) {
|
| | | org.eclipse.jgit.util.FileUtils.delete(luceneIndex,
|
| | |
| | |
|
| | | Map<String, ObjectId> paths = new TreeMap<String, ObjectId>();
|
| | | while (treeWalk.next()) {
|
| | | // ensure path is not in a submodule
|
| | | if (treeWalk.getFileMode(0) != FileMode.GITLINK) {
|
| | | paths.put(treeWalk.getPathString(), treeWalk.getObjectId(0));
|
| | | }
|
| | |
| | | Resolution.MINUTE);
|
| | | IndexWriter writer = getIndexWriter(repositoryName);
|
| | | for (PathChangeModel path : changedPaths) {
|
| | | if (path.isSubmodule()) {
|
| | | continue;
|
| | | }
|
| | | // delete the indexed blob
|
| | | deleteBlob(repositoryName, branch, path.name);
|
| | |
|
| | |
| | | // read the blob content
|
| | | String str = JGitUtils.getStringContent(repository, commit.getTree(),
|
| | | path.path, encodings);
|
| | | doc.add(new Field(FIELD_CONTENT, str, Store.YES, Index.ANALYZED));
|
| | | writer.addDocument(doc);
|
| | | if (str != null) {
|
| | | doc.add(new Field(FIELD_CONTENT, str, Store.YES, Index.ANALYZED));
|
| | | writer.addDocument(doc);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|