docs: @SuppressWarnings("unchecked")
    public void distributedProcess(ResponseBuilder rb, ComponentFields mtasFields)
        throws IOException {
      // System.out.println("collection: " + System.nanoTime() + " - "
      // + Thread.currentThread().getId() + " - "
      // + rb.req.getParams().getBool("isShard", false) + " DISTRIBUTEDPROCESS "
      // + rb.stage + " " + rb.req.getParamString());
      NamedList<Object> mtasResponse = null;
      try {
        mtasResponse = (NamedList<Object>) rb.rsp.getValues()
            .get(MtasSolrSearchComponent.NAME);
      } catch (ClassCastException e) {
        log.debug(e);
        mtasResponse = null;
      }
      if (mtasResponse != null) {
        if (rb.stage == MtasSolrSearchComponent.STAGE_COLLECTION_INIT) {
          // build index
          Map<String, MtasSolrCollectionResult> index = new HashMap<>();
          ArrayList<Object> mtasResponseCollection;
          try {
            mtasResponseCollection = (ArrayList<Object>) mtasResponse.get(NAME);
            for (Object item : mtasResponseCollection) {
              if (item instanceof SimpleOrderedMap) {
                SimpleOrderedMap<Object> itemMap = (SimpleOrderedMap<Object>) item;
                if (itemMap.get("data") != null
                    && itemMap.get("data") instanceof MtasSolrCollectionResult) {
                  MtasSolrCollectionResult collectionItem = (MtasSolrCollectionResult) itemMap
                      .get("data");
                  index.put(collectionItem.id(), collectionItem);
                }
              }
            }
          } catch (ClassCastException e) {
            log.debug(e);
            mtasResponse.remove(NAME);
          }
          // check and remove previous responses
          Map<String, Set<String>> createPostAfterMissingCheckResult = new HashMap<>();
          for (ShardRequest sreq : rb.finished) {
            if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
                && sreq.params.getBool(PARAM_MTAS_COLLECTION, false)) {
              for (ShardResponse shardResponse : sreq.responses) {
                NamedList<Object> solrShardResponse = shardResponse
                    .getSolrResponse().getResponse();
                try {
                  ArrayList<SimpleOrderedMap<Object>> data = (ArrayList<SimpleOrderedMap<Object>>) solrShardResponse
                      .findRecursive(MtasSolrSearchComponent.NAME, NAME);
                  if (data != null) {
                    for (SimpleOrderedMap<Object> dataItem : data) {
                      if (dataItem.get("data") != null && dataItem
                          .get("data") instanceof MtasSolrCollectionResult) {
                        MtasSolrCollectionResult dataItemResult = (MtasSolrCollectionResult) dataItem
                            .get("data");
                        if (index.containsKey(dataItemResult.id())
                            && index.get(dataItemResult.id()).action()
                                .equals(ComponentCollection.ACTION_CHECK)) {
                          if (dataItemResult.status == null) {
                            if (!createPostAfterMissingCheckResult
                                .containsKey(shardResponse.getShard())) {
                              createPostAfterMissingCheckResult
                                  .put(shardResponse.getShard(), new HashSet<>());
                            }
                            createPostAfterMissingCheckResult
                                .get(shardResponse.getShard())
                                .add(dataItemResult.id());
                          }
                        }
                      }
                    }
                    data.clear();
                  }
                } catch (ClassCastException e) {
                  log.debug(e);
                  // shouldn't happen
                }
              }
            }
          }
          // construct new requests
          HashMap<String, ModifiableSolrParams> requestParamList = new HashMap<>();
          int id = 0;
          for (ComponentCollection componentCollection : mtasFields.collection) {
            if (componentCollection.action()
                .equals(ComponentCollection.ACTION_CHECK)) {
              for (String shardAddress : rb.shards) {
                if (createPostAfterMissingCheckResult.containsKey(shardAddress)) {
                  if (createPostAfterMissingCheckResult.get(shardAddress)
                      .contains(componentCollection.id)) {
                    HashSet<String> values = searchComponent.getCollectionCache()
                        .getDataById(componentCollection.id);
                    if (values != null) {
                      ModifiableSolrParams paramsNewRequest;
                      if (!requestParamList.containsKey(shardAddress)) {
                        paramsNewRequest = new ModifiableSolrParams();
                        requestParamList.put(shardAddress, paramsNewRequest);
                      } else {
                        paramsNewRequest = requestParamList.get(shardAddress);
                      }
                      paramsNewRequest.add(
                          PARAM_MTAS_COLLECTION + "." + id + "."
                              + NAME_MTAS_COLLECTION_KEY,
                          componentCollection.key);
                      paramsNewRequest.add(PARAM_MTAS_COLLECTION + "." + id + "."
                          + NAME_MTAS_COLLECTION_ID, componentCollection.id);
                      paramsNewRequest.add(
                          PARAM_MTAS_COLLECTION + "." + id + "."
                              + NAME_MTAS_COLLECTION_ACTION,
                          ComponentCollection.ACTION_POST);
                      paramsNewRequest.add(
                          PARAM_MTAS_COLLECTION + "." + id + "."
                              + NAME_MTAS_COLLECTION_POST,
                          stringValuesToString(values));
                      id++;
                    }
                  }
                }
              }
            } else if (componentCollection.action()
                .equals(ComponentCollection.ACTION_CREATE)) {
              if (componentCollection.version == null) {
                componentCollection.version = searchComponent.getCollectionCache()
                    .create(componentCollection.id,
                        componentCollection.values().size(),
                        componentCollection.values(), null);
              }
              if (index.containsKey(componentCollection.id)) {
                index.get(componentCollection.id).setCreate(
                    searchComponent.getCollectionCache().now(), searchComponent
                        .getCollectionCache().check(componentCollection.id));
              }
              for (String shardAddress : rb.shards) {
                ModifiableSolrParams paramsNewRequest;
                if (!requestParamList.containsKey(shardAddress)) {
                  paramsNewRequest = new ModifiableSolrParams();
                  requestParamList.put(shardAddress, paramsNewRequest);
                } else {
                  paramsNewRequest = requestParamList.get(shardAddress);
                }
                paramsNewRequest.add(PARAM_MTAS_COLLECTION + "." + id + "."
                    + NAME_MTAS_COLLECTION_KEY, componentCollection.key);
                paramsNewRequest.add(PARAM_MTAS_COLLECTION + "." + id + "."
                    + NAME_MTAS_COLLECTION_ID, componentCollection.id);
                paramsNewRequest.add(
                    PARAM_MTAS_COLLECTION + "." + id + "."
                        + NAME_MTAS_COLLECTION_ACTION,
                    ComponentCollection.ACTION_POST);
                paramsNewRequest.add(
                    PARAM_MTAS_COLLECTION + "." + id + "."
                        + NAME_MTAS_COLLECTION_VERSION,
                        componentCollection.version);
                paramsNewRequest.add(
                    PARAM_MTAS_COLLECTION + "." + id + "."
                        + NAME_MTAS_COLLECTION_POST,
                    stringValuesToString(componentCollection.values()));
              }
            }
            id++;
          }
          // add new requests
          for (Entry<String, ModifiableSolrParams> entry : requestParamList
              .entrySet()) {
            ShardRequest newSreq = new ShardRequest();
            newSreq.shards = new String[] { entry.getKey() };
            newSreq.purpose = ShardRequest.PURPOSE_PRIVATE;
            newSreq.params = entry.getValue();
            newSreq.params.add(CommonParams.Q, "*");
            newSreq.params.add(CommonParams.ROWS, "0");
            newSreq.params.add(MtasSolrSearchComponent.PARAM_MTAS,
                rb.req.getOriginalParams()
                    .getParams(MtasSolrSearchComponent.PARAM_MTAS));
            newSreq.params.add(PARAM_MTAS_COLLECTION,
                rb.req.getOriginalParams().getParams(PARAM_MTAS_COLLECTION));
            rb.addRequest(searchComponent, newSreq);
          }
        } else if (rb.stage == MtasSolrSearchComponent.STAGE_COLLECTION_FINISH) {
          // just rewrite
          ArrayList<Object> mtasResponseCollection;
          try {
            mtasResponseCollection = (ArrayList<Object>) mtasResponse.get(NAME);
            if (mtasResponseCollection != null) {
              MtasSolrResultUtil.rewrite(mtasResponseCollection, searchComponent);
            }
          } catch (ClassCastException e) {
            log.debug(e);
            mtasResponse.remove(NAME);
          }
        }
      }
    }