Use '(state:active OR state:read-only)' when querying projects

Gerrit supports empty projects query only from v3.9 onwards, whilst
for earlier versions the NumberOfProjectsCollector needs to rely
on a query that would match any project state.

Using an empty query would make the git-repo-metrics fail on earlier
Gerrit versions.

Change-Id: Ifd0a72a73ab48d4e72868f6f38b14fd526f5ea28
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitrepometrics/collectors/NumberOfProjectsCollector.java b/src/main/java/com/googlesource/gerrit/plugins/gitrepometrics/collectors/NumberOfProjectsCollector.java
index 4e41e1d..8a42900 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/gitrepometrics/collectors/NumberOfProjectsCollector.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/gitrepometrics/collectors/NumberOfProjectsCollector.java
@@ -46,7 +46,7 @@
 
   private static long queryNumberOfProjects(OneOffRequestContext ctx, GerritApi api) {
     try (ManualRequestContext c = ctx.open()) {
-      return api.projects().query().get().size();
+      return api.projects().query("(state:active OR state:read-only)").get().size();
     } catch (RestApiException e) {
       logger.atWarning().withCause(e).log("Unable to query Gerrit projects list");
       throw new IllegalStateException(e);