From a004081b913c1bcf50184ee76df00bf889965d98 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Wed, 21 Mar 2012 18:04:34 -0400 Subject: [PATCH] Documentation --- src/com/gitblit/LuceneExecutor.java | 37 ++++++++++++++++--------------------- 1 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/com/gitblit/LuceneExecutor.java b/src/com/gitblit/LuceneExecutor.java index e859947..65e1b2b 100644 --- a/src/com/gitblit/LuceneExecutor.java +++ b/src/com/gitblit/LuceneExecutor.java @@ -148,26 +148,12 @@ } /** - * 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)) { @@ -636,7 +622,7 @@ IndexWriter writer = getIndexWriter(repositoryName); for (PathChangeModel path : changedPaths) { // delete the indexed blob - deleteBlob(repositoryName, branch, path.path); + deleteBlob(repositoryName, branch, path.name); // re-index the blob if (!ChangeType.DELETE.equals(path.changeType)) { @@ -669,8 +655,17 @@ } } writer.commit(); - - Document doc = createDocument(commit, null); + + // get any annotated commit tags + List<String> commitTags = new ArrayList<String>(); + for (RefModel ref : JGitUtils.getTags(repository, true, -1)) { + if (ref.isAnnotatedTag() && ref.getReferencedObjectId().equals(commit.getId())) { + commitTags.add(ref.displayName); + } + } + + // create and write the Lucene document + Document doc = createDocument(commit, commitTags); doc.add(new Field(FIELD_BRANCH, branch, Store.YES, Index.ANALYZED)); result.commitCount++; result.success = index(repositoryName, doc); @@ -1138,7 +1133,7 @@ Highlighter highlighter = new Highlighter(formatter, scorer); highlighter.setTextFragmenter(fragmenter); - String [] fragments = highlighter.getBestFragments(analyzer, "content", content, 5); + String [] fragments = highlighter.getBestFragments(analyzer, "content", content, 3); if (ArrayUtils.isEmpty(fragments)) { if (SearchObjectType.blob == result.type) { return ""; -- Gitblit v1.9.1