docs: public <T> SearchResult<T> querySearchResult(String query, Class<T> classOfT) {
          InputStream instream = null;
          try {
              Reader reader = new InputStreamReader(instream = queryForStream(query), "UTF-8");
              JsonObject json = new JsonParser().parse(reader).getAsJsonObject();
              SearchResult<T> sr = new SearchResult<T>();
              sr.setTotalRows(getAsLong(json, "total_rows"));
              sr.setBookmark(getAsString(json, "bookmark"));
              if (json.has("rows")) {
                  sr.setRows(getRows(json.getAsJsonArray("rows"), sr, classOfT));
              } else if (json.has("groups")) {
                  setGroups(json.getAsJsonArray("groups"), sr, classOfT);
              }
  
              if (json.has("counts")) {
                  sr.setCounts(getFieldsCounts(json.getAsJsonObject("counts").entrySet()));
              }
  
              if (json.has("ranges")) {
                  sr.setRanges(getFieldsCounts(json.getAsJsonObject("ranges").entrySet()));
              }
              return sr;
          } catch (UnsupportedEncodingException e) {
              // This should never happen as every implementation of the java platform is required
              // to support UTF-8.
              throw new RuntimeException(e);
          } finally {
              close(instream);
          }
      }