Initial implementation of account index in Lucene
This is much simpler than changes, since we don't have so many stored fields to deal with, and there is no open/closed split. LuceneAccountIndex is a very straightforward implementation of AbstractLuceneIndex; there is probably even more that can be factored out when it comes time to add yet more indexes. Change-Id: I530003a36152b4330b9e91a7a777eabcf2aeb361
This commit is contained in:
committed by
Edwin Kempin
parent
0558e9d0a4
commit
d1969dec32
@@ -14,6 +14,8 @@
|
||||
|
||||
package com.google.gerrit.server.index;
|
||||
|
||||
import com.google.gerrit.server.account.AccountState;
|
||||
import com.google.gerrit.server.index.account.AccountIndex;
|
||||
import com.google.gerrit.server.index.change.ChangeIndex;
|
||||
import com.google.gerrit.server.index.change.DummyChangeIndex;
|
||||
import com.google.gerrit.server.query.change.ChangeData;
|
||||
@@ -27,11 +29,19 @@ public class DummyIndexModule extends AbstractModule {
|
||||
}
|
||||
}
|
||||
|
||||
private static class DummyAccountIndexFactory implements AccountIndex.Factory {
|
||||
@Override
|
||||
public AccountIndex create(Schema<AccountState> schema) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
install(new IndexModule(1));
|
||||
bind(IndexConfig.class).toInstance(IndexConfig.createDefault());
|
||||
bind(Index.class).toInstance(new DummyChangeIndex());
|
||||
bind(AccountIndex.Factory.class).toInstance(new DummyAccountIndexFactory());
|
||||
bind(ChangeIndex.Factory.class).toInstance(new DummyChangeIndexFactory());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.google.gerrit.lifecycle.LifecycleModule;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.git.WorkQueue;
|
||||
import com.google.gerrit.server.index.account.AccountIndexDefinition;
|
||||
import com.google.gerrit.server.index.account.AccountSchemaDefinitions;
|
||||
import com.google.gerrit.server.index.change.ChangeIndexCollection;
|
||||
import com.google.gerrit.server.index.change.ChangeIndexDefinition;
|
||||
import com.google.gerrit.server.index.change.ChangeIndexer;
|
||||
@@ -55,6 +57,7 @@ public class IndexModule extends LifecycleModule {
|
||||
|
||||
public static final ImmutableCollection<SchemaDefinitions<?>> ALL_SCHEMA_DEFS =
|
||||
ImmutableList.<SchemaDefinitions<?>> of(
|
||||
AccountSchemaDefinitions.INSTANCE,
|
||||
ChangeSchemaDefinitions.INSTANCE);
|
||||
|
||||
/** Type of secondary index. */
|
||||
@@ -91,9 +94,12 @@ public class IndexModule extends LifecycleModule {
|
||||
|
||||
@Provides
|
||||
Collection<IndexDefinition<?, ?, ?>> getIndexDefinitions(
|
||||
AccountIndexDefinition accounts,
|
||||
ChangeIndexDefinition changes) {
|
||||
Collection<IndexDefinition<?, ?, ?>> result =
|
||||
ImmutableList.<IndexDefinition<?, ?, ?>> of(changes);
|
||||
ImmutableList.<IndexDefinition<?, ?, ?>> of(
|
||||
accounts,
|
||||
changes);
|
||||
Set<String> expected = FluentIterable.from(ALL_SCHEMA_DEFS)
|
||||
.transform(new Function<SchemaDefinitions<?>, String>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user