docs: public static void collectCollection(IndexReader reader, List<Integer> docSet,
        ComponentCollection collectionInfo) throws IOException {
      if (collectionInfo.action().equals(ComponentCollection.ACTION_CHECK)) {
        // can't do anything in lucene for check
      } else if (collectionInfo.action()
          .equals(ComponentCollection.ACTION_LIST)) {
        // can't do anything in lucene for list
      } else if (collectionInfo.action()
          .equals(ComponentCollection.ACTION_CREATE)) {
        BytesRef term = null;
        PostingsEnum postingsEnum = null;
        Integer docId;
        Integer termDocId = -1;
        Terms terms;
        LeafReaderContext lrc;
        LeafReader r;
        ListIterator<LeafReaderContext> iterator = reader.leaves().listIterator();
        while (iterator.hasNext()) {
          lrc = iterator.next();
          r = lrc.reader();
          for (String field : collectionInfo.fields()) {
            if ((terms = r.terms(field)) != null) {
              TermsEnum termsEnum = terms.iterator();
              while ((term = termsEnum.next()) != null) {
                Iterator<Integer> docIterator = docSet.iterator();
                postingsEnum = termsEnum.postings(postingsEnum,
                    PostingsEnum.NONE);
                termDocId = -1;
                while (docIterator.hasNext()) {
                  docId = docIterator.next() - lrc.docBase;
                  if ((docId >= termDocId) && ((docId.equals(termDocId))
                      || ((termDocId = postingsEnum.advance(docId))
                          .equals(docId)))) {
                    collectionInfo.addValue(term.utf8ToString());
                    break;
                  }
                  if (termDocId.equals(PostingsEnum.NO_MORE_DOCS)) {
                    break;
                  }
                }
              }
            }
          }
        }
      }
    }