code: private boolean goToNextStartPosition() throws IOException {
      int basicStartPositionMin;
      int basicStartPositionMax;
      int basicEndPosition;
      int basicEndPositionMin;
      int basicEndPositionMax;
      if (docId == -1 || docId == NO_MORE_DOCS) {
        throw new IOException("no document");
      } else {
        if (lastCollectedStartPosition < NO_MORE_POSITIONS
            && (collectedPositions.isEmpty()
                || (collectedPositions.firstKey() >= (lastCollectedStartPosition
                    - query.maximumLeft)))) {
          // collect new positions
          while ((lastCollectedStartPosition = subSpans
              .nextStartPosition()) != NO_MORE_POSITIONS) {
            basicEndPosition = subSpans.endPosition();
            basicStartPositionMin = Math.max(minPosition,
                lastCollectedStartPosition - query.maximumLeft);
            basicStartPositionMax = lastCollectedStartPosition
                - query.minimumLeft;
            basicEndPositionMin = basicEndPosition + query.minimumRight;
            basicEndPositionMax = Math.min(maxPosition + 1,
                basicEndPosition + query.maximumRight);
            for (int cLeft = basicStartPositionMin; cLeft <= basicStartPositionMax; cLeft++) {
              for (int cRight = basicEndPositionMin; cRight <= basicEndPositionMax; cRight++) {
                if (!collectedPositions.containsKey(cLeft)) {
                  collectedPositions.put(cLeft, new ArrayList<Integer>());
                }
                collectedPositions.get(cLeft).add(cRight);
              }
            }
            if (!collectedPositions.isEmpty() && (collectedPositions
                .firstKey() < (lastCollectedStartPosition - query.maximumLeft))) {
              break;
            }
          }
        }
        if (collectedPositions.isEmpty()) {
          return false;
        } else {
          startPosition = collectedPositions.firstKey();
          endPosition = collectedPositions.get(startPosition).remove(0);
          if (collectedPositions.get(startPosition).isEmpty()) {
            collectedPositions.remove(startPosition);
          }
          return true;
        }
      }
    }
docs: Go to next start position.
  
  @return true, if successful
  @throws IOException Signals that an I/O exception has occurred.