Index groups that are created during init
During the initialization of a new site some default groups are automatically created ('Administrators' and 'Non-Interactive Users'). These new groups must be added to the index so that they become queryable. For this init must have the group index available so that it can write the new groups to it. Reading from the index during init is not needed and not supported. Alternatively we could require users to run the Reindex program after the initial site initialization, but likely many people would forget about it and then wonder why the default groups are not available from the group index. Change-Id: I274b142a6efde224bba68f8b5c459736d7a1f985 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -30,6 +30,7 @@ import com.google.gerrit.server.query.QueryParseException;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.gwtorm.server.ResultSet;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
@@ -75,7 +76,7 @@ public class LuceneGroupIndex extends
|
||||
|
||||
private final GerritIndexWriterConfig indexWriterConfig;
|
||||
private final QueryBuilder<AccountGroup> queryBuilder;
|
||||
private final GroupCache groupCache;
|
||||
private final Provider<GroupCache> groupCache;
|
||||
|
||||
private static Directory dir(Schema<AccountGroup> schema, Config cfg,
|
||||
SitePaths sitePaths) throws IOException {
|
||||
@@ -91,7 +92,7 @@ public class LuceneGroupIndex extends
|
||||
LuceneGroupIndex(
|
||||
@GerritServerConfig Config cfg,
|
||||
SitePaths sitePaths,
|
||||
GroupCache groupCache,
|
||||
Provider<GroupCache> groupCache,
|
||||
@Assisted Schema<AccountGroup> schema) throws IOException {
|
||||
super(schema, sitePaths, dir(schema, cfg, sitePaths), GROUPS, null,
|
||||
new GerritIndexWriterConfig(cfg, GROUPS), new SearcherFactory());
|
||||
@@ -193,6 +194,6 @@ public class LuceneGroupIndex extends
|
||||
new AccountGroup.UUID(doc.getField(UUID.getName()).stringValue());
|
||||
// Use the GroupCache rather than depending on any stored fields in the
|
||||
// document (of which there shouldn't be any).
|
||||
return groupCache.get(uuid);
|
||||
return groupCache.get().get(uuid);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user