Add AccountIndexRewriter
The AccountIndexRewriter only translates Predicate<AccountState> to IndexedAccountQuery. It is much simpler than the ChangeIndexRewriter because for the account index there are no subindices and all predicates are served by the index. If a predicates requires a field that is not contained in the current index schema we would just fail those queries at the QueryBuilder. Change-Id: Ib0e8bcba9b475d861b102a8a7c51fcf13a3418ae Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -45,13 +45,13 @@ import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class IndexRewriterTest extends GerritBaseTests {
|
||||
public class ChangeIndexRewriterTest extends GerritBaseTests {
|
||||
private static final IndexConfig CONFIG = IndexConfig.createDefault();
|
||||
|
||||
private FakeChangeIndex index;
|
||||
private ChangeIndexCollection indexes;
|
||||
private ChangeQueryBuilder queryBuilder;
|
||||
private IndexRewriter rewrite;
|
||||
private ChangeIndexRewriter rewrite;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -59,7 +59,7 @@ public class IndexRewriterTest extends GerritBaseTests {
|
||||
indexes = new ChangeIndexCollection();
|
||||
indexes.setSearchIndex(index);
|
||||
queryBuilder = new FakeQueryBuilder(indexes);
|
||||
rewrite = new IndexRewriter(indexes,
|
||||
rewrite = new ChangeIndexRewriter(indexes,
|
||||
IndexConfig.create(0, 0, 3));
|
||||
}
|
||||
|
||||
@@ -292,6 +292,6 @@ public class IndexRewriterTest extends GerritBaseTests {
|
||||
}
|
||||
|
||||
private Set<Change.Status> status(String query) throws QueryParseException {
|
||||
return IndexRewriter.getPossibleStatus(parse(query));
|
||||
return ChangeIndexRewriter.getPossibleStatus(parse(query));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user