Merge "Fix case-insensitive searching of hashtags" into stable-2.16

This commit is contained in:
Edwin Kempin 2018-12-19 11:47:35 +00:00 committed by Gerrit Code Review
commit 9166ccc32c
2 changed files with 6 additions and 2 deletions

View File

@ -20,7 +20,9 @@ import com.google.gwtorm.server.OrmException;
public class HashtagPredicate extends ChangeIndexPredicate {
public HashtagPredicate(String hashtag) {
super(ChangeField.HASHTAG, HashtagsUtil.cleanupHashtag(hashtag));
// Use toLowerCase without locale to match behavior in ChangeField.
// TODO(dborowitz): Change both.
super(ChangeField.HASHTAG, HashtagsUtil.cleanupHashtag(hashtag).toLowerCase());
}
@Override

View File

@ -1597,7 +1597,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
in.add = ImmutableSet.of("foo");
gApi.changes().id(change1.getId().get()).setHashtags(in);
in.add = ImmutableSet.of("foo", "bar", "a tag");
in.add = ImmutableSet.of("foo", "bar", "a tag", "ACamelCaseTag");
gApi.changes().id(change2.getId().get()).setHashtags(in);
return ImmutableList.of(change1, change2);
@ -1614,6 +1614,8 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
assertQuery("hashtag:\" a tag \"", changes.get(1));
assertQuery("hashtag:\"#a tag\"", changes.get(1));
assertQuery("hashtag:\"# #a tag\"", changes.get(1));
assertQuery("hashtag:acamelcasetag", changes.get(1));
assertQuery("hashtag:ACamelCaseTAg", changes.get(1));
}
@Test