Make Lucene case insensitive when searching for hashtags

The Hashtags will still be stored as case sensitive. A
future HashtagValidator/HashtagTransformer @Extensionpoint
could allow users to finetune how the hashtags are
stored and accepted.

Change-Id: Ibb6d6343a228fcafb6f482597655281792f85a62
This commit is contained in:
Gustaf Lundh
2014-09-12 10:26:30 +02:00
parent 9c1393279f
commit bfc79d408e
2 changed files with 19 additions and 3 deletions

View File

@@ -14,8 +14,11 @@
package com.google.gerrit.server.index;
import com.google.common.base.Function;
import com.google.common.base.MoreObjects;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.gerrit.reviewdb.client.Account;
@@ -232,7 +235,15 @@ public class ChangeField {
@Override
public Iterable<String> get(ChangeData input, FillArgs args)
throws OrmException {
return input.notes().load().getHashtags();
return ImmutableSet.copyOf(Iterables.transform(input.notes().load()
.getHashtags(), new Function<String, String>() {
@Override
public String apply(String input) {
return input.toLowerCase();
}
}));
}
};