docs: public void finishStage(ResponseBuilder rb) {
      // System.out.println(
      // "collection: " + System.nanoTime() + " - " +
      // Thread.currentThread().getId()
      // + " - " + rb.req.getParams().getBool("isShard", false)
      // + " FINISHSTAGE " + rb.stage + " " + rb.req.getParamString());
      if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)) {
        if (rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY
            && rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
          ComponentFields mtasFields = getMtasFields(rb);
          if (mtasFields.doCollection) {
            if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) {
              // mtas response
              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) {
                mtasResponse = new SimpleOrderedMap<>();
                rb.rsp.add(MtasSolrSearchComponent.NAME, mtasResponse);
              }
              ArrayList<Object> mtasCollectionResponses;
              if (mtasResponse.get(NAME) != null
                  && mtasResponse.get(NAME) instanceof ArrayList) {
                mtasCollectionResponses = (ArrayList<Object>) mtasResponse
                    .get(NAME);
              } else {
                mtasCollectionResponses = new ArrayList<>();
                mtasResponse.add(NAME, mtasCollectionResponses);
              }
              MtasSolrCollectionResult collectionResult;
              for (ComponentCollection componentCollection : mtasFields.collection) {
                try {
                  collectionResult = createMtasSolrCollectionResult(
                      componentCollection, false);
                  // Create response
                  SimpleOrderedMap<Object> mtasCollectionResponse = new SimpleOrderedMap<>();
                  mtasCollectionResponse.add("key", componentCollection.key);
                  mtasCollectionResponse.add("data", collectionResult);
                  mtasCollectionResponses.add(mtasCollectionResponse);
                } catch (IOException e) {
                  log.debug(e);
                }
              }
            }
            // decode shard responses
            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) {
                      MtasSolrResultUtil.decode(data);
                      if (rb.stage > ResponseBuilder.STAGE_EXECUTE_QUERY) {
                        ArrayList<SimpleOrderedMap<Object>> filteredData = new ArrayList<>();
                        for (SimpleOrderedMap<Object> dataItem : data) {
                          if (dataItem.get("data") != null && dataItem
                              .get("data") instanceof MtasSolrCollectionResult) {
                            MtasSolrCollectionResult collectionResult = (MtasSolrCollectionResult) dataItem
                                .get("data");
                            if (rb.stage <= MtasSolrSearchComponent.STAGE_COLLECTION_INIT) {
                              if (!collectionResult.action()
                                  .equals(ComponentCollection.ACTION_CREATE)
                                  && !collectionResult.action()
                                      .equals(ComponentCollection.ACTION_LIST)
                                  && !collectionResult.action()
                                      .equals(ComponentCollection.ACTION_CHECK)) {
                                filteredData.add(dataItem);
                              }
                            } else if (rb.stage <= MtasSolrSearchComponent.STAGE_COLLECTION_FINISH) {
                              if (!collectionResult.action()
                                  .equals(ComponentCollection.ACTION_POST)
                                  && !collectionResult.action()
                                      .equals(ComponentCollection.ACTION_IMPORT)
                                  && !collectionResult.action()
                                      .equals(ComponentCollection.ACTION_CHECK)) {
                                filteredData.add(dataItem);
                              }
                            }
                          } else {
                            filteredData.add(dataItem);
                          }
                        }
                        data.clear();
                        data.addAll(filteredData);
                      }
                    }
                  } catch (ClassCastException e) {
                    log.debug(e);
                    // shouldn't happen
                  }
                }
              }
            }
          }
        }
      }
    }