code: @Override
    public int advance(int target) throws IOException {
      reset();
      if (docId == NO_MORE_DOCS) {
        return docId;
      } else if (target < docId) {
        // should not happen
        docId = NO_MORE_DOCS;
        return docId;
      } else {
        // advance 1
        int spans1DocId = spans1.spans.docID();
        int newTarget = target;
        if (spans1DocId < newTarget) {
          spans1DocId = spans1.spans.advance(target);
          if (spans1DocId == NO_MORE_DOCS) {
            docId = NO_MORE_DOCS;
            return docId;
          }
          newTarget = Math.max(newTarget, spans1DocId);
        }
        int spans2DocId = spans2.spans.docID();
        // advance 2
        if (spans2DocId < newTarget) {
          spans2DocId = spans2.spans.advance(newTarget);
          if (spans2DocId == NO_MORE_DOCS) {
            docId = NO_MORE_DOCS;
            return docId;
          }
        }
        // check equal docId, otherwise next
        if (spans1DocId == spans2DocId) {
          docId = spans1DocId;
          // check match
          if (goToNextStartPosition()) {
            return docId;
          } else {
            return nextDoc();
          }
        } else {
          return nextDoc();
        }
      }
    }
docs: /*
  (non-Javadoc)
  
  @see org.apache.lucene.search.DocIdSetIterator#advance(int)