Correct group lookup by name from the index

The case sensitive name was used when adding a group to the index but
the lower case version was used for lookups. As this doesn't work for
names containing capital letters, we switch to a case sensitive lookup.
(Lookups for the full name of an account also use a case sensitive
lookup.)

Change-Id: I90bcd7d4b0918031f0d7431841eabb57e2fdfde8
This commit is contained in:
Alice Kober-Sotzek
2017-08-22 18:04:33 +02:00
parent f0c81b6a89
commit 43d5115c98
2 changed files with 3 additions and 4 deletions

View File

@@ -37,8 +37,7 @@ public class GroupPredicates {
}
public static Predicate<AccountGroup> name(String name) {
return new GroupPredicate(
GroupField.NAME, GroupQueryBuilder.FIELD_NAME, name.toLowerCase(Locale.US));
return new GroupPredicate(GroupField.NAME, GroupQueryBuilder.FIELD_NAME, name);
}
public static Predicate<AccountGroup> owner(AccountGroup.UUID ownerUuid) {

View File

@@ -185,9 +185,9 @@ public abstract class AbstractQueryGroupsTest extends GerritServerTests {
public void byName() throws Exception {
assertQuery("name:non-existing");
GroupInfo group = createGroup(name("group"));
GroupInfo group = createGroup(name("Group"));
assertQuery("name:" + group.name, group);
assertQuery("name:" + group.name.toUpperCase(Locale.US), group);
assertQuery("name:" + group.name.toLowerCase(Locale.US));
// only exact match
GroupInfo groupWithHyphen = createGroup(name("group-with-hyphen"));