code: void merge(MtasSolrMtasResult newItem) throws IOException {
      HashMap<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map = new HashMap<>();
      if (newItem.dataCollector.withTotal()) {
        dataCollector.setWithTotal();
      }
      dataCollector.merge(newItem.dataCollector, map, true);
      if (newItem.functionData != null) {
        if (functionData == null) {
          functionData = new HashMap<>();
        }
        for (MtasDataCollector<?, ?> keyCollector : newItem.functionData
            .keySet()) {
          if (map.containsKey(keyCollector)) {
            // compute mapped key
            MtasDataCollector<?, ?> newKeyCollector = keyCollector;
            while (map.containsKey(newKeyCollector)) {
              newKeyCollector = map.get(keyCollector);
            }
            if (functionData.containsKey(newKeyCollector)) {
              HashMap<String, MtasSolrMtasResult> tmpList = functionData
                  .get(newKeyCollector);
              for (String functionKey : newItem.functionData.get(keyCollector)
                  .keySet()) {
                if (tmpList.containsKey(functionKey)) {
                  tmpList.get(functionKey).merge(
                      newItem.functionData.get(keyCollector).get(functionKey));
                } else {
                  tmpList.put(functionKey,
                      newItem.functionData.get(keyCollector).get(functionKey));
                }
              }
            } else {
              functionData.put(newKeyCollector,
                  newItem.functionData.get(keyCollector));
            }
          }
        }
      }
    }
docs: Merge.
  
  @param newItem the new item
  @throws IOException Signals that an I/O exception has occurred.