Add full name to account index and query by full name in AccountResolver
Add a new field for the full name to the account index that allows exact lookups by full name. In AccountResolver do lookups by full name via the account index, if an account index exists. This is a preparation for moving the account properties from ReviewDb into git. Change-Id: I1dc2eae98280b70354b48f6333d23b89acc8501a Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -182,15 +182,14 @@ public class AccountResolver {
|
||||
return Collections.singleton(id);
|
||||
}
|
||||
|
||||
List<Account> m = schema.get().accounts().byFullName(nameOrEmail).toList();
|
||||
if (m.size() == 1) {
|
||||
return Collections.singleton(m.get(0).getId());
|
||||
}
|
||||
|
||||
// At this point we have no clue. Just perform a whole bunch of suggestions
|
||||
// and pray we come up with a reasonable result list.
|
||||
//
|
||||
if (accountIndexes.getSearchIndex() != null) {
|
||||
List<AccountState> m = accountQueryProvider.get().byFullName(nameOrEmail);
|
||||
if (m.size() == 1) {
|
||||
return Collections.singleton(m.get(0).getAccount().getId());
|
||||
}
|
||||
|
||||
// At this point we have no clue. Just perform a whole bunch of suggestions
|
||||
// and pray we come up with a reasonable result list.
|
||||
return FluentIterable
|
||||
.from(accountQueryProvider.get().byDefault(nameOrEmail))
|
||||
.transform(new Function<AccountState, Account.Id>() {
|
||||
@@ -201,6 +200,13 @@ public class AccountResolver {
|
||||
}).toSet();
|
||||
}
|
||||
|
||||
List<Account> m = schema.get().accounts().byFullName(nameOrEmail).toList();
|
||||
if (m.size() == 1) {
|
||||
return Collections.singleton(m.get(0).getId());
|
||||
}
|
||||
|
||||
// At this point we have no clue. Just perform a whole bunch of suggestions
|
||||
// and pray we come up with a reasonable result list.
|
||||
Set<Account.Id> result = new HashSet<>();
|
||||
String a = nameOrEmail;
|
||||
String b = nameOrEmail + "\u9fa5";
|
||||
|
Reference in New Issue
Block a user