docs: public static void collectField(String field, IndexSearcher searcher,
        IndexReader reader, IndexReader rawReader, List<Integer> fullDocList,
        List<Integer> fullDocSet, ComponentField fieldInfo,
        Map<MtasSpanQuery, SpanWeight> spansQueryWeight, Status status)
        throws IllegalAccessException, IllegalArgumentException,
        InvocationTargetException, IOException {
  
      Map<Integer, List<Integer>> docSets = new HashMap<>();
  
      ListIterator<LeafReaderContext> iterator = reader.leaves().listIterator();
      long numberOfDocumentsFound = 0;
      if (status != null) {
        status.init(reader.numDocs(), reader.leaves().size());
        if (fullDocSet != null && status.numberDocumentsFound == null) {
          status.numberDocumentsFound = numberOfDocumentsFound;
        }
      }
  
      while (iterator.hasNext()) {
        // try
        // {
        // Thread.sleep(10000);
        // }
        // catch(InterruptedException ex)
        // {
        // Thread.currentThread().interrupt();
        // }
        LeafReaderContext lrc = iterator.next();
        LeafReader r = lrc.reader();
        // compute relevant docSet/docList
        List<Integer> docSet = null;
        List<Integer> docList = null;
        if (fullDocSet != null) {
          docSet = new ArrayList<>();
          docSets.put(lrc.ord, docSet);
          Iterator<Integer> docSetIterator = fullDocSet.iterator();
          Integer docSetId = null;
          Bits liveDocs = lrc.reader().getLiveDocs();
          while (docSetIterator.hasNext()) {
            docSetId = docSetIterator.next();
            // just to make sure to ignore deleted documents
            if ((docSetId >= lrc.docBase)
                && (docSetId < lrc.docBase + lrc.reader().maxDoc())
                && (liveDocs == null || liveDocs.get((docSetId - lrc.docBase)))) {
              docSet.add(docSetId);
            }
          }
          Collections.sort(docSet);
          numberOfDocumentsFound += docSet.size();
          status.numberDocumentsFound = Math.max(status.numberDocumentsFound,
              numberOfDocumentsFound);
        }
        if (fullDocList != null) {
          docList = new ArrayList<>();
          Iterator<Integer> docListIterator = fullDocList.iterator();
          Integer docListId = null;
          while (docListIterator.hasNext()) {
            docListId = docListIterator.next();
            if ((docListId >= lrc.docBase)
                && (docListId < lrc.docBase + lrc.reader().maxDoc())) {
              docList.add(docListId);
            }
          }
          Collections.sort(docList);
        }
  
        Terms t = rawReader.leaves().get(lrc.ord).reader().terms(field);
        CodecInfo mtasCodecInfo = t == null ? null
            : CodecInfo.getCodecInfoFromTerms(t);
  
        collectSpansPositionsAndTokens(spansQueryWeight, searcher, mtasCodecInfo,
            r, lrc, field, t, docSet, docList, fieldInfo,
            rawReader.leaves().get(lrc.ord).reader().getFieldInfos(), status);
        collectPrefixes(rawReader.leaves().get(lrc.ord).reader().getFieldInfos(),
            field, fieldInfo, status);
  
        if (status != null) {
          Integer segmentNumber;
          Long documentNumber;
          if ((segmentNumber = status.subNumberSegmentsFinished
              .get(field)) != null) {
            status.subNumberSegmentsFinished.put(field, segmentNumber + 1);
            status.subNumberSegmentsFinishedTotal++;
            status.numberSegmentsFinished = Collections
                .max(status.subNumberSegmentsFinished.values());
          }
          if ((documentNumber = status.subNumberDocumentsFinished
              .get(field)) != null) {
            status.subNumberDocumentsFinished.put(field,
                documentNumber + r.numDocs());
            status.subNumberDocumentsFinishedTotal += +r.numDocs();
            status.numberDocumentsFinished = Collections
                .max(status.subNumberDocumentsFinished.values());
          }
        }
      }
  
      // check termvectors
      if (!fieldInfo.termVectorList.isEmpty()
          && needSecondRoundTermvector(fieldInfo.termVectorList)) {
        // check positions
        boolean needPositions = false;
        if (!fieldInfo.termVectorList.isEmpty()) {
          for (ComponentTermVector ctv : fieldInfo.termVectorList) {
            if (!needPositions) {
              needPositions = ctv.functions != null ? ctv.functionNeedPositions()
                  : needPositions;
            }
          }
        }
        Map<Integer, Integer> positionsData = null;
  
        // loop
        iterator = reader.leaves().listIterator();
        while (iterator.hasNext()) {
          LeafReaderContext lrc = iterator.next();
          LeafReader r = lrc.reader();
          List<Integer> docSet = docSets.get(lrc.ord);
          Terms t = rawReader.leaves().get(lrc.ord).reader().terms(field);
          if (needPositions) {
            CodecInfo mtasCodecInfo = t == null ? null
                : CodecInfo.getCodecInfoFromTerms(t);
            positionsData = computePositions(mtasCodecInfo, r, lrc, field,
                docSet);
          }
          createTermvectorSecondRound(fieldInfo.termVectorList, positionsData,
              docSets.get(lrc.ord), t, r, lrc, status);
        }
  
      }
    }