src/com/gitblit/utils/LuceneUtils.java | ●●●●● patch | view | raw | blame | history | |
tests/com/gitblit/tests/GitBlitSuite.java | ●●●●● patch | view | raw | blame | history | |
tests/com/gitblit/tests/LuceneUtilsTest.java | ●●●●● patch | view | raw | blame | history |
src/com/gitblit/utils/LuceneUtils.java
@@ -292,12 +292,13 @@ TreeWalk treeWalk = new TreeWalk(repository); treeWalk.addTree(branchHead.getTree()); treeWalk.setRecursive(true); while (treeWalk.next()) { result.blobCount++; String blobPath = treeWalk.getPathString(); RevCommit blobRev = branchHead; RevWalk blobWalk = null; if (fullIndex) { // XXX this is _really_ slow, there must be a better way @@ -308,11 +309,7 @@ PathFilterGroup.createFromStrings(Collections.singleton(blobPath)), TreeFilter.ANY_DIFF); blobWalk.setTreeFilter(filter); for (RevCommit commit : blobWalk) { blobRev = commit; break; } blobRev = blobWalk.next(); } String blobAuthor = getAuthor(blobRev); @@ -321,7 +318,7 @@ Resolution.MINUTE); if (blobWalk != null) { blobWalk.dispose(); blobWalk.dispose(); } Document doc = new Document(); tests/com/gitblit/tests/GitBlitSuite.java
@@ -91,7 +91,7 @@ } public static Repository getGitectiveRepository() throws Exception { return new FileRepository(new File("test/gitective.git")); return new FileRepository(new File(REPOSITORIES, "test/gitective.git")); } public static boolean startGitblit() throws Exception { tests/com/gitblit/tests/LuceneUtilsTest.java
@@ -35,7 +35,7 @@ public class LuceneUtilsTest { @Test public void testFullIndex() throws Exception { public void testQuickIndex() throws Exception { // reindex helloworld Repository repository = GitBlitSuite.getHelloworldRepository(); String name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(), @@ -61,6 +61,20 @@ } @Test public void testFullIndex() throws Exception { // reindex helloworld Repository repository = GitBlitSuite.getHelloworldRepository(); String name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(), repository.getDirectory().getAbsolutePath()); LuceneUtils.reindex(name, repository, true); SearchResult result = LuceneUtils.search("type:blob AND id:bit.bit", 1, repository).get(0); repository.close(); assertEquals("Mike Donaghy", result.author); //assertEquals("Mike Donaghy", result.date); LuceneUtils.close(); } @Test public void testQuery() throws Exception { // 2 occurrences on the master branch Repository repository = GitBlitSuite.getHelloworldRepository();