code: @Override
    public Collection<Event> findEvents(SearchCriteria criteria) {
      ensureInitialized();
  
      Preconditions.checkNotNull(criteria, "criteria must be non-null");
  
      Collection<Event> matches = new ArrayList<>();
  
      User user = criteria.getUser();
      DetectionPoint detectionPoint = criteria.getDetectionPoint();
      Rule rule = criteria.getRule();
      Collection<String> detectionSystemIds = criteria.getDetectionSystemIds();
      DateTime earliest = DateUtils.fromString(criteria.getEarliest());
  
      String influxQL = Utils.constructInfluxQL(Utils.EVENTS, user,
        detectionPoint, null,
        detectionSystemIds,
        earliest,
        Utils.QueryMode.IGNORE_THRESHOLDS);
  
      if (rule != null) {
        influxQL += " AND (";
  
        int i = 0;
        for (DetectionPoint point : rule.getAllDetectionPoints()) {
          influxQL += (i == 0) ? "" : " OR ";
  
          influxQL += "(";
          influxQL += Utils.constructDetectionPointSqlString(point, Utils.QueryMode.IGNORE_THRESHOLDS);
          influxQL += ")";
  
          i++;
        }
  
        influxQL += ")";
      }
  
      Query query = new Query(influxQL, Utils.DATABASE);
  
      QueryResult results = influxDB.query(query);
  
      for(QueryResult.Result result : results.getResults()) {
        if(result == null || result.getSeries() == null) {
          continue;
        }
  
        for(QueryResult.Series series : result.getSeries()) {
          if(series == null || series.getValues() == null) {
            continue;
          }
  
          for(List<Object> record : series.getValues()) {
            if(record == null) {
              continue;
            }
  
            matches.add( gson.fromJson( Utils.getValue(Utils.JSON_CONTENT, series, record), Event.class ) );
          }
  
        }
      }
  
      return matches;
    }
docs: {@inheritDoc}