Add a "projects" field for searching projects by prefix

Index alongside the "project" field, which is an exact match field,
since we do not assume index implementations can search exact match
and prefix on the same field. We do not want to modify the existing
"project" to return prefixes.

Upgrade Lucene to 4.7.0, as this was released since the last schema
change.

Change-Id: I7c3379c087fc54af3e5790cb875a5e676e674338
This commit is contained in:
Dave Borowitz
2014-03-25 14:17:03 -07:00
parent 2212801e98
commit 4aed07b7ce
13 changed files with 129 additions and 8 deletions

View File

@@ -304,10 +304,29 @@ public abstract class AbstractQueryChangesTest {
Change change2 = newChange(repo2, null, null, null, null).insert();
assertTrue(query("project:foo").isEmpty());
assertTrue(query("project:repo").isEmpty());
assertResultEquals(change1, queryOne("project:repo1"));
assertResultEquals(change2, queryOne("project:repo2"));
}
@Test
public void byProjectPrefix() throws Exception {
TestRepository<InMemoryRepository> repo1 = createProject("repo1");
TestRepository<InMemoryRepository> repo2 = createProject("repo2");
Change change1 = newChange(repo1, null, null, null, null).insert();
Change change2 = newChange(repo2, null, null, null, null).insert();
assertTrue(query("projects:foo").isEmpty());
assertResultEquals(change1, queryOne("projects:repo1"));
assertResultEquals(change2, queryOne("projects:repo2"));
List<ChangeInfo> results;
results = query("projects:repo");
assertEquals(results.toString(), 2, results.size());
assertResultEquals(change2, results.get(0));
assertResultEquals(change1, results.get(1));
}
@Test
public void byBranchAndRef() throws Exception {
TestRepository<InMemoryRepository> repo = createProject("repo");

View File

@@ -32,6 +32,7 @@ import com.google.inject.Injector;
import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.Config;
import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
@@ -43,6 +44,13 @@ public class LuceneQueryChangesV7Test extends AbstractQueryChangesTest {
return Guice.createInjector(new InMemoryModule(cfg));
}
// Tests for features not supported in V7.
@Ignore
@Override
@Test
public void byProjectPrefix() {}
// End tests for features not supported in V7.
@Test
public void pagination() throws Exception {
TestRepository<InMemoryRepository> repo = createProject("repo");