"gitblit", null, "postReceiveScript")));\r
model.mailingLists = new ArrayList<String>(Arrays.asList(config.getStringList(\r
"gitblit", null, "mailingList")));\r
+ model.indexedBranches = new ArrayList<String>(Arrays.asList(config.getStringList(\r
+ "gitblit", null, "indexBranch")));\r
}\r
model.HEAD = JGitUtils.getHEADRef(r);\r
model.availableRefs = JGitUtils.getAvailableHeadTargets(r);\r
// create repository\r
logger.info("create repository " + repository.name);\r
r = JGitUtils.createRepository(repositoriesFolder, repository.name);\r
+ \r
+ // automatically index master branch if Lucene integration is enabled\r
+ if (luceneExecutor.isReady()) {\r
+ repository.indexedBranches = new ArrayList<String>();\r
+ repository.indexedBranches.add("refs/heads/master");\r
+ }\r
} else {\r
// rename repository\r
if (!repositoryName.equalsIgnoreCase(repository.name)) {\r
if (!ArrayUtils.isEmpty(repository.mailingLists)) {\r
config.setStringList("gitblit", null, "mailingList", repository.mailingLists);\r
}\r
+ if (!ArrayUtils.isEmpty(repository.indexedBranches)) {\r
+ config.setStringList("gitblit", null, "indexBranch", repository.indexedBranches);\r
+ }\r
try {\r
config.save();\r
} catch (IOException e) {\r
import com.gitblit.models.IssueModel.Attachment;\r
import com.gitblit.models.PathModel.PathChangeModel;\r
import com.gitblit.models.RefModel;\r
+import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.SearchResult;\r
import com.gitblit.utils.ArrayUtils;\r
import com.gitblit.utils.IssueUtils;\r
"arj", "bin", "bmp", "dll", "doc", "docx", "exe", "gif", "gz", "jar", "jpg", "lib",\r
"lzh", "odg", "pdf", "ppt", "png", "so", "swf", "xcf", "xls", "xlsx", "zip"));\r
\r
- private final Set<String> excludedBranches = new TreeSet<String>(\r
- Arrays.asList("/refs/heads/gb-issues"));\r
- \r
public LuceneExecutor(IStoredSettings settings, File repositoriesFolder) {\r
this.storedSettings = settings;\r
this.repositoriesFolder = repositoriesFolder;\r
return;\r
}\r
\r
- for (String repositoryName : GitBlit.self().getRepositoryList()) {\r
- Repository repository = GitBlit.self().getRepository(repositoryName);\r
- if (repository == null) {\r
- logger.warn(MessageFormat.format(\r
- "Lucene executor could not find repository {0}. Skipping.",\r
- repositoryName));\r
- continue;\r
+ for (String repositoryName: GitBlit.self().getRepositoryList()) {\r
+ RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);\r
+ if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {\r
+ Repository repository = GitBlit.self().getRepository(model.name);\r
+ index(model, repository); \r
+ repository.close();\r
+ System.gc();\r
}\r
- // TODO allow repository to bypass Lucene indexing \r
- index(repositoryName, repository);\r
- repository.close();\r
- System.gc();\r
}\r
}\r
\r
* @param repository\r
* the repository object\r
*/\r
- protected void index(String name, Repository repository) {\r
+ protected void index(RepositoryModel model, Repository repository) {\r
try {\r
- if (JGitUtils.hasCommits(repository)) {\r
- if (shouldReindex(repository)) {\r
- // (re)build the entire index \r
- IndexResult result = reindex(name, repository);\r
- \r
- if (result.success) {\r
- if (result.commitCount > 0) {\r
- String msg = "Built {0} Lucene index from {1} commits and {2} files across {3} branches in {4} secs";\r
- logger.info(MessageFormat.format(msg, name,\r
- result.commitCount, result.blobCount, result.branchCount, result.duration()));\r
- }\r
- } else {\r
- String msg = "Could not build {0} Lucene index!";\r
- logger.error(MessageFormat.format(msg, name));\r
+ if (shouldReindex(repository)) {\r
+ // (re)build the entire index\r
+ IndexResult result = reindex(model, repository);\r
+\r
+ if (result.success) {\r
+ if (result.commitCount > 0) {\r
+ String msg = "Built {0} Lucene index from {1} commits and {2} files across {3} branches in {4} secs";\r
+ logger.info(MessageFormat.format(msg, model.name, result.commitCount,\r
+ result.blobCount, result.branchCount, result.duration()));\r
}\r
} else {\r
- // update the index with latest commits \r
- IndexResult result = updateIndex(name, repository);\r
- if (result.success) {\r
- if (result.commitCount > 0) {\r
- String msg = "Updated {0} Lucene index with {1} commits and {2} files across {3} branches in {4} secs";\r
- logger.info(MessageFormat.format(msg, name,\r
- result.commitCount, result.blobCount, result.branchCount, result.duration()));\r
- }\r
- } else {\r
- String msg = "Could not update {0} Lucene index!";\r
- logger.error(MessageFormat.format(msg, name));\r
- }\r
+ String msg = "Could not build {0} Lucene index!";\r
+ logger.error(MessageFormat.format(msg, model.name));\r
}\r
} else {\r
- logger.info(MessageFormat.format("Skipped Lucene index of empty repository {0}",\r
- name));\r
+ // update the index with latest commits\r
+ IndexResult result = updateIndex(model, repository);\r
+ if (result.success) {\r
+ if (result.commitCount > 0) {\r
+ String msg = "Updated {0} Lucene index with {1} commits and {2} files across {3} branches in {4} secs";\r
+ logger.info(MessageFormat.format(msg, model.name, result.commitCount,\r
+ result.blobCount, result.branchCount, result.duration()));\r
+ }\r
+ } else {\r
+ String msg = "Could not update {0} Lucene index!";\r
+ logger.error(MessageFormat.format(msg, model.name));\r
+ }\r
}\r
} catch (Throwable t) {\r
- logger.error(MessageFormat.format("Lucene indexing failure for {0}", name), t);\r
+ logger.error(MessageFormat.format("Lucene indexing failure for {0}", model.name), t);\r
}\r
}\r
\r
* @param repository\r
* @return IndexResult\r
*/\r
- public IndexResult reindex(String repositoryName, Repository repository) {\r
+ public IndexResult reindex(RepositoryModel model, Repository repository) {\r
IndexResult result = new IndexResult();\r
- if (!deleteIndex(repositoryName)) {\r
+ if (!deleteIndex(model.name)) {\r
return result;\r
}\r
try { \r
FileBasedConfig config = getConfig(repository);\r
Set<String> indexedCommits = new TreeSet<String>();\r
- IndexWriter writer = getIndexWriter(repositoryName);\r
+ IndexWriter writer = getIndexWriter(model.name);\r
// build a quick lookup of tags\r
Map<String, List<String>> tags = new HashMap<String, List<String>>();\r
for (RefModel tag : JGitUtils.getTags(repository, false, -1)) {\r
\r
// walk through each branch\r
for (RefModel branch : branches) {\r
- if (excludedBranches.contains(branch.getName())) {\r
+\r
+ // if this branch is not specifically indexed then skip\r
+ if (!model.indexedBranches.contains(branch.getName())) {\r
continue;\r
}\r
\r
// commit all changes and reset the searcher\r
config.setInt(CONF_INDEX, null, CONF_VERSION, INDEX_VERSION);\r
config.save();\r
- resetIndexSearcher(repositoryName);\r
+ resetIndexSearcher(model.name);\r
writer.commit();\r
result.success();\r
} catch (Exception e) {\r
- logger.error("Exception while reindexing " + repositoryName, e);\r
+ logger.error("Exception while reindexing " + model.name, e);\r
}\r
return result;\r
}\r
String branch, RevCommit commit) {\r
IndexResult result = new IndexResult();\r
try {\r
- if (excludedBranches.contains(branch)) {\r
- if (IssueUtils.GB_ISSUES.equals(branch)) {\r
- // index an issue\r
- String issueId = commit.getShortMessage().substring(2).trim();\r
- IssueModel issue = IssueUtils.getIssue(repository, issueId);\r
- if (issue == null) {\r
- // issue was deleted, remove from index\r
- deleteIssue(repositoryName, issueId);\r
- result.success = true;\r
- return result;\r
- }\r
- result.success = index(repositoryName, issue);\r
- result.issueCount++;\r
- return result;\r
- \r
- }\r
- return result;\r
- }\r
List<PathChangeModel> changedPaths = JGitUtils.getFilesInCommit(repository, commit);\r
String revDate = DateTools.timeToString(commit.getCommitTime() * 1000L,\r
Resolution.MINUTE);\r
/**\r
* Updates a repository index incrementally from the last indexed commits.\r
* \r
- * @param repositoryName\r
+ * @param model\r
* @param repository\r
* @return IndexResult\r
*/\r
- protected IndexResult updateIndex(String repositoryName, Repository repository) {\r
+ protected IndexResult updateIndex(RepositoryModel model, Repository repository) {\r
IndexResult result = new IndexResult();\r
try {\r
FileBasedConfig config = getConfig(repository);\r
for (RefModel branch : branches) {\r
String branchName = branch.getName();\r
\r
+ // determine if we should skip this branch\r
+ if (!IssueUtils.GB_ISSUES.equals(branch)\r
+ && !model.indexedBranches.contains(branch.getName())) {\r
+ continue;\r
+ }\r
+ \r
// remove this branch from the deletedBranches set\r
deletedBranches.remove(branchName);\r
\r
result.branchCount += 1;\r
}\r
\r
+ // track the issue ids that we have already indexed\r
+ Set<String> indexedIssues = new TreeSet<String>();\r
+ \r
// reverse the list of commits so we start with the first commit \r
Collections.reverse(revs);\r
- for (RevCommit commit : revs) {\r
- result.add(index(repositoryName, repository, branchName, commit)); \r
+ for (RevCommit commit : revs) { \r
+ if (IssueUtils.GB_ISSUES.equals(branch)) {\r
+ // only index an issue once during updateIndex\r
+ String issueId = commit.getShortMessage().substring(2).trim();\r
+ if (indexedIssues.contains(issueId)) {\r
+ continue;\r
+ }\r
+ indexedIssues.add(issueId);\r
+ \r
+ IssueModel issue = IssueUtils.getIssue(repository, issueId);\r
+ if (issue == null) {\r
+ // issue was deleted, remove from index\r
+ deleteIssue(model.name, issueId);\r
+ } else {\r
+ // issue was updated\r
+ index(model.name, issue);\r
+ result.issueCount++;\r
+ }\r
+ } else {\r
+ // index a commit\r
+ result.add(index(model.name, repository, branchName, commit));\r
+ }\r
}\r
\r
// update the config\r
// unless a branch really was deleted and no longer exists\r
if (deletedBranches.size() > 0) {\r
for (String branch : deletedBranches) {\r
- IndexWriter writer = getIndexWriter(repositoryName);\r
+ IndexWriter writer = getIndexWriter(model.name);\r
writer.deleteDocuments(new Term(FIELD_BRANCH, branch));\r
writer.commit();\r
}\r
}\r
result.success = true;\r
} catch (Throwable t) {\r
- logger.error(MessageFormat.format("Exception while updating {0} Lucene index", repositoryName), t);\r
+ logger.error(MessageFormat.format("Exception while updating {0} Lucene index", model.name), t);\r
}\r
return result;\r
}\r
public String origin;\r
public String HEAD;\r
public List<String> availableRefs;\r
+ public List<String> indexedBranches;\r
public String size;\r
public List<String> preReceiveScripts;\r
public List<String> postReceiveScripts;\r
this.lastChange = lastchange;\r
this.accessRestriction = AccessRestrictionType.NONE;\r
this.federationSets = new ArrayList<String>();\r
- this.federationStrategy = FederationStrategy.FEDERATE_THIS;\r
+ this.federationStrategy = FederationStrategy.FEDERATE_THIS; \r
}\r
\r
@Override\r
gb.query = query\r
gb.queryHelp = write brief explanation of Lucene syntax here\r
gb.authored = authored\r
-gb.committed = committed
\ No newline at end of file
+gb.committed = committed\r
+gb.indexedBranches = indexed branches\r
+gb.indexedBranchesDescription = select the branches to include in your Lucene index\r
+gb.noIndexedRepositoriesWarning = none of your repositories are configured for Lucene indexing\r
+gb.undefinedQueryWarning = query is undefined!\r
+gb.gb.noSelectedRepositoriesWarning = please select one or more repositories!
\ No newline at end of file
<tr><td colspan="2"><h3><wicket:message key="gb.federation"></wicket:message> <small><wicket:message key="gb.federationRepositoryDescription"></wicket:message></small></h3></td></tr> \r
<tr><th><wicket:message key="gb.federationStrategy"></wicket:message></th><td class="edit"><select class="span4" wicket:id="federationStrategy" tabindex="15" /></td></tr>\r
<tr><th style="vertical-align: top;"><wicket:message key="gb.federationSets"></wicket:message></th><td style="padding:2px;"><span wicket:id="federationSets"></span></td></tr>\r
+ <tr><td colspan="2"><h3><wicket:message key="gb.search"></wicket:message> <small><wicket:message key="gb.indexedBranchesDescription"></wicket:message></small></h3></td></tr> \r
+ <tr><th style="vertical-align: top;"><wicket:message key="gb.indexedBranches"></wicket:message></th><td style="padding:2px;"><span wicket:id="indexedBranches"></span></td></tr>\r
<tr><td colspan="2"><h3><wicket:message key="gb.hookScripts"></wicket:message> <small><wicket:message key="gb.hookScriptsDescription"></wicket:message></small></h3></td></tr> \r
<tr><th style="vertical-align: top;"><wicket:message key="gb.preReceiveScripts"></wicket:message><p></p><span wicket:id="inheritedPreReceive"></span></th><td style="padding:2px;"><span wicket:id="preReceiveScripts"></span></td></tr>\r
<tr><th style="vertical-align: top;"><wicket:message key="gb.postReceiveScripts"></wicket:message><p></p><span wicket:id="inheritedPostReceive"></span></th><td style="padding:2px;"><span wicket:id="postReceiveScripts"></span></td></tr>\r
import org.apache.wicket.model.Model;\r
import org.apache.wicket.model.util.CollectionModel;\r
import org.apache.wicket.model.util.ListModel;\r
+import org.eclipse.jgit.lib.Constants;\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
import com.gitblit.Constants.FederationStrategy;\r
// ensure this user can create or edit this repository\r
checkPermissions(repositoryModel);\r
\r
+ List<String> indexedBranches = new ArrayList<String>();\r
List<String> federationSets = new ArrayList<String>();\r
List<String> repositoryUsers = new ArrayList<String>();\r
List<String> repositoryTeams = new ArrayList<String>();\r
Collections.sort(repositoryUsers);\r
}\r
federationSets.addAll(repositoryModel.federationSets);\r
+ if (!ArrayUtils.isEmpty(repositoryModel.indexedBranches)) {\r
+ indexedBranches.addAll(repositoryModel.indexedBranches);\r
+ }\r
}\r
\r
final String oldName = repositoryModel.name;\r
// teams palette\r
final Palette<String> teamsPalette = new Palette<String>("teams", new ListModel<String>(\r
repositoryTeams), new CollectionModel<String>(GitBlit.self().getAllTeamnames()),\r
- new StringChoiceRenderer(), 5, false);\r
+ new StringChoiceRenderer(), 8, false);\r
\r
+ // indexed local branches palette\r
+ List<String> allLocalBranches = new ArrayList<String>();\r
+ if (!ArrayUtils.isEmpty(repositoryModel.availableRefs)) {\r
+ for (String ref : repositoryModel.availableRefs) {\r
+ if (ref.startsWith(Constants.R_HEADS)) {\r
+ allLocalBranches.add(ref);\r
+ }\r
+ }\r
+ }\r
+ final Palette<String> indexedBranchesPalette = new Palette<String>("indexedBranches", new ListModel<String>(\r
+ indexedBranches), new CollectionModel<String>(allLocalBranches),\r
+ new StringChoiceRenderer(), 8, false);\r
+ indexedBranchesPalette.setEnabled(allLocalBranches.size() > 0);\r
+\r
+ \r
// federation sets palette\r
List<String> sets = GitBlit.getStrings(Keys.federation.sets);\r
final Palette<String> federationSetsPalette = new Palette<String>("federationSets",\r
new ListModel<String>(federationSets), new CollectionModel<String>(sets),\r
- new StringChoiceRenderer(), 5, false);\r
+ new StringChoiceRenderer(), 8, false);\r
\r
// pre-receive palette\r
if (!ArrayUtils.isEmpty(repositoryModel.preReceiveScripts)) {\r
repositoryModel.mailingLists = new ArrayList<String>(list);\r
}\r
\r
+ // indexed branches\r
+ List<String> indexedBranches = new ArrayList<String>();\r
+ Iterator<String> branches = indexedBranchesPalette.getSelectedChoices();\r
+ while (branches.hasNext()) {\r
+ indexedBranches.add(branches.next());\r
+ }\r
+ repositoryModel.indexedBranches = indexedBranches;\r
+\r
// pre-receive scripts\r
List<String> preReceiveScripts = new ArrayList<String>();\r
Iterator<String> pres = preReceivePalette.getSelectedChoices();\r
form.add(new DropDownChoice<FederationStrategy>("federationStrategy", federationStrategies,\r
new FederationTypeRenderer()));\r
form.add(new CheckBox("useTickets"));\r
- form.add(new CheckBox("useDocs"));\r
+ form.add(new CheckBox("useDocs")); \r
form.add(new CheckBox("showRemoteBranches"));\r
form.add(new CheckBox("showReadme"));\r
form.add(new CheckBox("skipSizeCalculation"));\r
mailingLists = new Model<String>(ArrayUtils.isEmpty(repositoryModel.mailingLists) ? ""\r
: StringUtils.flattenStrings(repositoryModel.mailingLists, " "));\r
form.add(new TextField<String>("mailingLists", mailingLists));\r
+ form.add(indexedBranchesPalette);\r
form.add(usersPalette);\r
form.add(teamsPalette);\r
form.add(federationSetsPalette);\r
}\r
}\r
\r
+ // display user-accessible selections\r
+ UserModel user = GitBlitWebSession.get().getUser();\r
+ List<String> availableRepositories = new ArrayList<String>();\r
+ for (RepositoryModel model : GitBlit.self().getRepositoryModels(user)) {\r
+ if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {\r
+ availableRepositories.add(model.name);\r
+ }\r
+ }\r
+ \r
+ if (availableRepositories.size() == 0) {\r
+ info(getString("gb.noIndexedRepositoriesWarning"));\r
+ }\r
+\r
+ // enforce user-accessible repository selections\r
+ ArrayList<String> searchRepositories = new ArrayList<String>();\r
+ for (String selectedRepository : repositories) {\r
+ if (availableRepositories.contains(selectedRepository)) {\r
+ searchRepositories.add(selectedRepository);\r
+ }\r
+ }\r
+ \r
// search form\r
final Model<String> queryModel = new Model<String>(query);\r
- final Model<ArrayList<String>> repositoriesModel = new Model<ArrayList<String>>(repositories);\r
+ final Model<ArrayList<String>> repositoriesModel = new Model<ArrayList<String>>(searchRepositories);\r
StatelessForm<Void> form = new StatelessForm<Void>("searchForm") {\r
\r
private static final long serialVersionUID = 1L;\r
public void onSubmit() {\r
String q = queryModel.getObject();\r
if (StringUtils.isEmpty(q)) {\r
- error("Query is empty!");\r
+ error(getString("gb.undefinedQueryWarning"));\r
return;\r
} \r
if (repositoriesModel.getObject().size() == 0) {\r
- error("Please select one or more repositories!");\r
+ error(getString("gb.noSelectedRepositoriesWarning"));\r
return;\r
}\r
PageParameters params = new PageParameters();\r
setResponsePage(LucenePage.class, params);\r
}\r
};\r
- \r
- UserModel user = GitBlitWebSession.get().getUser();\r
- List<String> availableRepositories = new ArrayList<String>();\r
- for (RepositoryModel model : GitBlit.self().getRepositoryModels(user)) {\r
- if (model.hasCommits) {\r
- availableRepositories.add(model.name);\r
- }\r
- }\r
+ \r
ListMultipleChoice<String> selections = new ListMultipleChoice<String>("repositories", \r
repositoriesModel, availableRepositories, new StringChoiceRenderer());\r
selections.setMaxRows(10);\r
\r
// execute search\r
final List<SearchResult> results = new ArrayList<SearchResult>();\r
- if (!ArrayUtils.isEmpty(repositories) && !StringUtils.isEmpty(query)) {\r
- results.addAll(GitBlit.self().search(query, 100, repositories));\r
+ if (!ArrayUtils.isEmpty(searchRepositories) && !StringUtils.isEmpty(query)) {\r
+ results.addAll(GitBlit.self().search(query, 100, searchRepositories));\r
}\r
\r
// search results view\r
import org.junit.Test;\r
\r
import com.gitblit.LuceneExecutor;\r
+import com.gitblit.models.RefModel;\r
+import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.SearchResult;\r
+import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
\r
/**\r
return new LuceneExecutor(null, GitBlitSuite.REPOSITORIES);\r
}\r
\r
- private String getName(Repository repository) {\r
- return StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(),\r
+ private RepositoryModel newRepositoryModel(Repository repository) { \r
+ RepositoryModel model = new RepositoryModel();\r
+ model.name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(),\r
repository.getDirectory().getAbsolutePath());\r
+ model.hasCommits = JGitUtils.hasCommits(repository);\r
+ \r
+ // index all local branches\r
+ model.indexedBranches = new ArrayList<String>();\r
+ for (RefModel ref : JGitUtils.getLocalBranches(repository, true, -1)) {\r
+ model.indexedBranches.add(ref.getName());\r
+ }\r
+ return model;\r
}\r
\r
@Test\r
\r
// reindex helloworld\r
Repository repository = GitBlitSuite.getHelloworldRepository();\r
- String name = getName(repository);\r
- lucene.reindex(name, repository);\r
+ RepositoryModel model = newRepositoryModel(repository);\r
+ lucene.reindex(model, repository);\r
repository.close();\r
\r
- SearchResult result = lucene.search("type:blob AND path:bit.bit", 1, name).get(0); \r
+ SearchResult result = lucene.search("type:blob AND path:bit.bit", 1, model.name).get(0); \r
assertEquals("Mike Donaghy", result.author);\r
- result = lucene.search("type:blob AND path:clipper.prg", 1, name).get(0); \r
+ result = lucene.search("type:blob AND path:clipper.prg", 1, model.name).get(0); \r
assertEquals("tinogomes", result.author); \r
\r
// reindex theoretical physics\r
repository = GitBlitSuite.getTheoreticalPhysicsRepository();\r
- name = getName(repository);\r
- lucene.reindex(name, repository);\r
+ model = newRepositoryModel(repository);\r
+ lucene.reindex(model, repository);\r
repository.close();\r
\r
// reindex JGit\r
repository = GitBlitSuite.getJGitRepository();\r
- name = getName(repository);\r
- lucene.reindex(name, repository);\r
+ model = newRepositoryModel(repository);\r
+ lucene.reindex(model, repository);\r
repository.close();\r
\r
lucene.close();\r
\r
// 2 occurrences on the master branch\r
Repository repository = GitBlitSuite.getHelloworldRepository(); \r
- String name = getName(repository);\r
+ RepositoryModel model = newRepositoryModel(repository);\r
repository.close();\r
\r
- List<SearchResult> results = lucene.search("ada", 10, name);\r
+ List<SearchResult> results = lucene.search("ada", 10, model.name);\r
assertEquals(2, results.size());\r
for (SearchResult res : results) {\r
assertEquals("refs/heads/master", res.branch);\r
}\r
\r
// author test\r
- results = lucene.search("author: tinogomes AND type:commit", 10, name);\r
+ results = lucene.search("author: tinogomes AND type:commit", 10, model.name);\r
assertEquals(2, results.size());\r
\r
// blob test\r
- results = lucene.search("type: blob AND \"import std.stdio\"", 10, name);\r
+ results = lucene.search("type: blob AND \"import std.stdio\"", 10, model.name);\r
assertEquals(1, results.size());\r
assertEquals("d.D", results.get(0).path);\r
\r
// 1 occurrence on the gh-pages branch\r
repository = GitBlitSuite.getTheoreticalPhysicsRepository();\r
- name = getName(repository);\r
+ model = newRepositoryModel(repository);\r
repository.close();\r
\r
- results = lucene.search("\"add the .nojekyll file\"", 10, name);\r
+ results = lucene.search("\"add the .nojekyll file\"", 10, model.name);\r
assertEquals(1, results.size());\r
assertEquals("Ondrej Certik", results.get(0).author);\r
assertEquals("2648c0c98f2101180715b4d432fc58d0e21a51d7", results.get(0).commitId);\r
assertEquals("refs/heads/gh-pages", results.get(0).branch);\r
\r
- results = lucene.search("type:blob AND \"src/intro.rst\"", 10, name);\r
+ results = lucene.search("type:blob AND \"src/intro.rst\"", 10, model.name);\r
assertEquals(4, results.size());\r
\r
// hash id tests\r
- results = lucene.search("commit:57c4f26f157ece24b02f4f10f5f68db1d2ce7ff5", 10, name);\r
+ results = lucene.search("commit:57c4f26f157ece24b02f4f10f5f68db1d2ce7ff5", 10, model.name);\r
assertEquals(1, results.size());\r
\r
- results = lucene.search("commit:57c4f26f157*", 10, name);\r
+ results = lucene.search("commit:57c4f26f157*", 10, model.name);\r
assertEquals(1, results.size()); \r
\r
// annotated tag test\r
repository = GitBlitSuite.getJGitRepository();\r
- name = getName(repository);\r
+ model = newRepositoryModel(repository);\r
repository.close();\r
\r
- results = lucene.search("I663208919f297836a9c16bf458e4a43ffaca4c12", 10, name);\r
+ results = lucene.search("I663208919f297836a9c16bf458e4a43ffaca4c12", 10, model.name);\r
assertEquals(1, results.size());\r
assertEquals("[v1.3.0.201202151440-r]", results.get(0).tags.toString()); \r
\r
LuceneExecutor lucene = newLuceneExecutor();\r
List<String> list = new ArrayList<String>();\r
Repository repository = GitBlitSuite.getHelloworldRepository();\r
- list.add(getName(repository));\r
+ list.add(newRepositoryModel(repository).name);\r
repository.close();\r
\r
repository = GitBlitSuite.getJGitRepository();\r
- list.add(getName(repository));\r
+ list.add(newRepositoryModel(repository).name);\r
repository.close();\r
\r
List<SearchResult> results = lucene.search("test", 10, list);\r