docs: public void prepare(ResponseBuilder rb, ComponentFields mtasFields)
        throws IOException {
      Set<String> ids = MtasSolrResultUtil
          .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_KWIC);
      if (!ids.isEmpty()) {
        int tmpCounter = 0;
        String[] fields = new String[ids.size()];
        String[] queryTypes = new String[ids.size()];
        String[] queryValues = new String[ids.size()];
        String[] queryPrefixes = new String[ids.size()];
        String[] queryIgnores = new String[ids.size()];
        String[] queryMaximumIgnoreLengths = new String[ids.size()];
        HashMap<String, String[]>[] queryVariables = new HashMap[ids.size()];
        String[] keys = new String[ids.size()];
        String[] prefixes = new String[ids.size()];
        String[] numbers = new String[ids.size()];
        String[] starts = new String[ids.size()];
        String[] lefts = new String[ids.size()];
        String[] rights = new String[ids.size()];
        String[] outputs = new String[ids.size()];
        for (String id : ids) {
          fields[tmpCounter] = rb.req.getParams()
              .get(PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_FIELD, null);
          queryTypes[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_QUERY_TYPE, null);
          queryValues[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_QUERY_VALUE,
              null);
          queryPrefixes[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_QUERY_PREFIX,
              null);
          queryIgnores[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_QUERY_IGNORE,
              null);
          queryMaximumIgnoreLengths[tmpCounter] = rb.req.getParams()
              .get(PARAM_MTAS_KWIC + "." + id + "."
                  + NAME_MTAS_KWIC_QUERY_MAXIMUM_IGNORE_LENGTH, null);
          Set<String> vIds = MtasSolrResultUtil.getIdsFromParameters(
              rb.req.getParams(),
              PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_QUERY_VARIABLE);
          queryVariables[tmpCounter] = new HashMap<>();
          if (!vIds.isEmpty()) {
            HashMap<String, ArrayList<String>> tmpVariables = new HashMap<>();
            for (String vId : vIds) {
              String name = rb.req.getParams().get(
                  PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_QUERY_VARIABLE
                      + "." + vId + "." + SUBNAME_MTAS_KWIC_QUERY_VARIABLE_NAME,
                  null);
              if (name != null) {
                if (!tmpVariables.containsKey(name)) {
                  tmpVariables.put(name, new ArrayList<String>());
                }
                String value = rb.req.getParams()
                    .get(PARAM_MTAS_KWIC + "." + id + "."
                        + NAME_MTAS_KWIC_QUERY_VARIABLE + "." + vId + "."
                        + SUBNAME_MTAS_KWIC_QUERY_VARIABLE_VALUE, null);
                if (value != null) {
                  ArrayList<String> list = new ArrayList<>();
                  String[] subList = value.split("(?<!\\\\),");
                  for (int i = 0; i < subList.length; i++) {
                    list.add(
                        subList[i].replace("\\,", ",").replace("\\\\", "\\"));
                  }
                  tmpVariables.get(name).addAll(list);
                }
              }
            }
            for (Entry<String, ArrayList<String>> entry : tmpVariables
                .entrySet()) {
              queryVariables[tmpCounter].put(entry.getKey(),
                  entry.getValue().toArray(new String[entry.getValue().size()]));
            }
          }
          keys[tmpCounter] = rb.req.getParams()
              .get(PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_KEY,
                  String.valueOf(tmpCounter))
              .trim();
          prefixes[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_PREFIX, null);
          numbers[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_NUMBER, null);
          starts[tmpCounter] = rb.req.getParams()
              .get(PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_START, null);
          lefts[tmpCounter] = rb.req.getParams()
              .get(PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_LEFT, null);
          rights[tmpCounter] = rb.req.getParams()
              .get(PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_RIGHT, null);
          starts[tmpCounter] = rb.req.getParams()
              .get(PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_START, null);
          outputs[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_KWIC + "." + id + "." + NAME_MTAS_KWIC_OUTPUT, null);
          tmpCounter++;
        }
        String uniqueKeyField = rb.req.getSchema().getUniqueKeyField().getName();
        mtasFields.doKwic = true;
        rb.setNeedDocList(true);
        for (String field : fields) {
          if (field == null || field.isEmpty()) {
            throw new IOException("no (valid) field in mtas kwic");
          } else if (!mtasFields.list.containsKey(field)) {
            mtasFields.list.put(field, new ComponentField(uniqueKeyField));
          }
        }
        MtasSolrResultUtil.compareAndCheck(keys, fields, NAME_MTAS_KWIC_KEY,
            NAME_MTAS_KWIC_FIELD, true);
        MtasSolrResultUtil.compareAndCheck(queryValues, fields,
            NAME_MTAS_KWIC_QUERY_VALUE, NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(queryTypes, fields,
            NAME_MTAS_KWIC_QUERY_TYPE, NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(queryPrefixes, fields,
            NAME_MTAS_KWIC_QUERY_PREFIX, NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(queryIgnores, fields,
            NAME_MTAS_KWIC_QUERY_IGNORE, NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(queryMaximumIgnoreLengths, fields,
            NAME_MTAS_KWIC_QUERY_MAXIMUM_IGNORE_LENGTH, NAME_MTAS_KWIC_FIELD,
            false);
        MtasSolrResultUtil.compareAndCheck(prefixes, fields,
            NAME_MTAS_KWIC_PREFIX, NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(numbers, fields, NAME_MTAS_KWIC_NUMBER,
            NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(starts, fields, NAME_MTAS_KWIC_START,
            NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(lefts, fields, NAME_MTAS_KWIC_LEFT,
            NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(rights, fields, NAME_MTAS_KWIC_RIGHT,
            NAME_MTAS_KWIC_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(outputs, fields, NAME_MTAS_KWIC_OUTPUT,
            NAME_MTAS_KWIC_FIELD, false);
        for (int i = 0; i < fields.length; i++) {
          ComponentField cf = mtasFields.list.get(fields[i]);
          Integer maximumIgnoreLength = (queryMaximumIgnoreLengths[i] == null)
              ? null : Integer.parseInt(queryMaximumIgnoreLengths[i]);
          MtasSpanQuery q = MtasSolrResultUtil.constructQuery(queryValues[i],
              queryTypes[i], queryPrefixes[i], queryVariables[i], fields[i],
              queryIgnores[i], maximumIgnoreLength);
          // minimize number of queries
          if (cf.spanQueryList.contains(q)) {
            q = cf.spanQueryList.get(cf.spanQueryList.indexOf(q));
          } else {
            cf.spanQueryList.add(q);
          }
          String key = (keys[i] == null) || (keys[i].isEmpty())
              ? String.valueOf(i) + ":" + fields[i] + ":" + queryValues[i]
              : keys[i].trim();
          String prefix = prefixes[i];
          Integer number = (numbers[i] != null) ? getPositiveInteger(numbers[i])
              : null;
          int start = getPositiveInteger(starts[i]);
          int left = getPositiveInteger(lefts[i]);
          int right = getPositiveInteger(rights[i]);
          String output = outputs[i];
          mtasFields.list.get(fields[i]).kwicList.add(new ComponentKwic(q, key,
              prefix, number, start, left, right, output));
        }
      }
    }