diff --git a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticConfiguration.java b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticConfiguration.java index 84dae7f238..4184ec06ce 100644 --- a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticConfiguration.java +++ b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticConfiguration.java @@ -80,11 +80,11 @@ class ElasticConfiguration { } } - public Config getConfig() { + Config getConfig() { return cfg; } - public String getIndexName(String name, int schemaVersion) { + String getIndexName(String name, int schemaVersion) { return String.format("%s%s_%04d", prefix, name, schemaVersion); } diff --git a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticIndexVersionManager.java b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticIndexVersionManager.java index 1ddff777a8..3d26cf3d9a 100644 --- a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticIndexVersionManager.java +++ b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticIndexVersionManager.java @@ -61,7 +61,7 @@ public class ElasticIndexVersionManager extends VersionManager { log.warn("Unrecognized version in index {}: {}", def.getName(), version); continue; } - versions.put(v, new Version(null, v, true, cfg.getReady(def.getName(), v))); + versions.put(v, new Version<>(null, v, true, cfg.getReady(def.getName(), v))); } } catch (IOException e) { log.error("Error scanning index: " + def.getName(), e); diff --git a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticQueryBuilder.java b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticQueryBuilder.java index 2a97e2ef39..394158dbc2 100644 --- a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticQueryBuilder.java +++ b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticQueryBuilder.java @@ -34,7 +34,7 @@ import java.time.Instant; public class ElasticQueryBuilder { - protected QueryBuilder toQueryBuilder(Predicate p) throws QueryParseException { + QueryBuilder toQueryBuilder(Predicate p) throws QueryParseException { if (p instanceof AndPredicate) { return and(p); } else if (p instanceof OrPredicate) { diff --git a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticVersion.java b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticVersion.java index ff26382a93..b65eb317f1 100644 --- a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticVersion.java +++ b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticVersion.java @@ -25,7 +25,7 @@ public enum ElasticVersion { private final String version; private final Pattern pattern; - private ElasticVersion(String version) { + ElasticVersion(String version) { this.version = version; this.pattern = Pattern.compile(version); } diff --git a/gerrit-elasticsearch/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java b/gerrit-elasticsearch/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java index 44725dc88f..7973fe279f 100644 --- a/gerrit-elasticsearch/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java +++ b/gerrit-elasticsearch/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java @@ -65,7 +65,7 @@ public class ElasticContainer> extends Gener } @Override - protected Set getLivenessCheckPorts() { + public Set getLivenessCheckPortNumbers() { return ImmutableSet.of(getMappedPort(ELASTICSEARCH_DEFAULT_PORT)); } diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java index a7413d35b8..2272c294c6 100644 --- a/gerrit-server/src/test/java/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java +++ b/gerrit-server/src/test/java/com/google/gerrit/server/query/change/AbstractQueryChangesTest.java @@ -880,6 +880,18 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { assertQuery("message:12346", change2); } + @Test + public void byMessageMixedCase() throws Exception { + TestRepository repo = createProject("repo"); + RevCommit commit1 = repo.parseBody(repo.commit().message("Hello gerrit").create()); + Change change1 = insert(repo, newChangeForCommit(repo, commit1)); + RevCommit commit2 = repo.parseBody(repo.commit().message("Hello Gerrit").create()); + Change change2 = insert(repo, newChangeForCommit(repo, commit2)); + + assertQuery("message:gerrit", change2, change1); + assertQuery("message:Gerrit", change2, change1); + } + @Test public void byLabel() throws Exception { accountManager.authenticate(AuthRequest.forUser("anotheruser"));