Merge changes If77b630b,I3bbeb623,I14ab15f1,Ia7777ac5,Iffae33bd

* changes:
  Add field for watched projects to account index
  Add project watches to AccountState
  Remove suggest.fullTextSearch option
  Use account index for reviewer suggestion
  Fix highlighting in suggestions with full text search
This commit is contained in:
David Pursehouse
2016-07-08 00:23:21 +00:00
committed by Gerrit Code Review
24 changed files with 261 additions and 368 deletions

View File

@@ -20,6 +20,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Iterables;
import com.google.gerrit.reviewdb.client.AccountExternalId;
import com.google.gerrit.reviewdb.client.AccountProjectWatch;
import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.index.FieldDef;
import com.google.gerrit.server.index.FieldType;
@@ -137,6 +138,21 @@ public class AccountField {
}
};
public static final FieldDef<AccountState, Iterable<String>> WATCHED_PROJECT =
new FieldDef.Repeatable<AccountState, String>(
"watchedproject", FieldType.EXACT, false) {
@Override
public Iterable<String> get(AccountState input, FillArgs args) {
return FluentIterable.from(input.getProjectWatches())
.transform(new Function<AccountProjectWatch, String>() {
@Override
public String apply(AccountProjectWatch in) {
return in.getProjectNameKey().get();
}
}).toSet();
}
};
private AccountField() {
}
}

View File

@@ -30,6 +30,9 @@ public class AccountSchemaDefinitions extends SchemaDefinitions<AccountState> {
AccountField.REGISTERED,
AccountField.USERNAME);
static final Schema<AccountState> V2 =
schema(V1, AccountField.WATCHED_PROJECT);
public static final AccountSchemaDefinitions INSTANCE =
new AccountSchemaDefinitions();