private boolean goToNextDoc() throws IOException {
    if (docId == NO_MORE_DOCS) {
      return true;
    } else {
      int spans1DocId = spans1.spans.nextDoc();
      int spans2DocId = spans2.spans.docID();
      docId = Math.max(spans1DocId, spans2DocId);
      while (spans1DocId != spans2DocId && docId != NO_MORE_DOCS) {
        if (spans1DocId < spans2DocId) {
          spans1DocId = spans1.spans.advance(spans2DocId);
          docId = spans1DocId;
        } else {
          spans2DocId = spans2.spans.advance(spans1DocId);
          docId = spans2DocId;
        }
      }
      if (docId != NO_MORE_DOCS && !goToNextStartPosition()) {
        reset();
        return false;
      } else {
        return true;
      }
    }
  }
private boolean goToNextDoc ( ) throws IOException { if ( docId == NO_MORE_DOCS ) { return true ; } else { int spans1DocId = spans1 . spans . nextDoc ( ) ; int spans2DocId = spans2 . spans . docID ( ) ; docId = Math . max ( spans1DocId , spans2DocId ) ; while ( spans1DocId != spans2DocId && docId != NO_MORE_DOCS ) { if ( spans1DocId < spans2DocId ) { spans1DocId = spans1 . spans . advance ( spans2DocId ) ; docId = spans1DocId ; } else { spans2DocId = spans2 . spans . advance ( spans1DocId ) ; docId = spans2DocId ; } } if ( docId != NO_MORE_DOCS && ! goToNextStartPosition ( ) ) { reset ( ) ; return false ; } else { return true ; } } }
Go to next doc.

@return true, if successful
@throws IOException Signals that an I/O exception has occurred.