Fix case-insensitive searching of hashtags

The index field has always been stored lowercase, since we intended
hashtag searches to be case-insensitive. However, we never converted the
input string to lower case, with the unexpected result that searching
for [hashtag:ACamelCaseTag] would not return results for changes who
contain that exact hashtag.

Change-Id: I86019d18fd0d183d857d5a91d2af20d3445c6c25
(cherry picked from commit c8d1c47f1f)
This commit is contained in:
Dave Borowitz
2018-12-18 10:50:22 -05:00
committed by David Pursehouse
parent cc8e7b5e7f
commit d9e1b93daa
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