private Map<String, List<QueryMetacardImpl>> groupBySource(
     List<QueryMetacardImpl> queryMetacards) {
   final Map<String, List<QueryMetacardImpl>> groupedBySource = new HashMap<>();
   for (QueryMetacardImpl queryMetacard : queryMetacards) {
     List<String> sources = queryMetacard.getSources();
     if (!sources.isEmpty()) {
       sources.forEach(sourceId -> groupedBySource.compute(sourceId, addToList(queryMetacard)));
     } else {
       groupedBySource.compute(UNKNOWN_SOURCE, addToList(queryMetacard));
     }
   }
   return groupedBySource;
 }
 private Filter metacardToFilter(QueryMetacardImpl queryMetacard) {
   try {
     return ECQL.toFilter(queryMetacard.getCql());
   } catch (CQLException e) {
     LOGGER.warn("Error parsing CQL", e);
     return null;
   }
 }