docs: private void findMatches(Match match, int n) throws IOException {
      if (n > 0) {
        int largestMatchingEndPosition = match.endPosition();
        Set<Integer> list = ignoreItem.getFullEndPositionList(spans.docID(),
            match.endPosition());
        // try to find matches with existing queue
        if (!queueSpans.isEmpty()) {
          Match span;
          for (int i = 0; i < queueSpans.size(); i++) {
            span = queueSpans.get(i);
            if (match.endPosition() == span.startPosition()
                || (list != null && list.contains(span.startPosition()))) {
              findMatches(new Match(match.startPosition(), span.endPosition()),
                  (n - 1));
              largestMatchingEndPosition = Math.max(largestMatchingEndPosition,
                  span.endPosition());
            }
          }
        }
        // extend queue if necessary and possible
        while (!lastSpan && (largestMatchingEndPosition >= lastStartPosition)) {
          if (spans.nextStartPosition() == NO_MORE_POSITIONS) {
            lastSpan = true;
          } else {
            Match span = new Match(spans.startPosition(), spans.endPosition());
            queueSpans.add(span);
            lastStartPosition = spans.startPosition();
            // check if this provides new match
            if (match.endPosition() == span.startPosition()
                || (list != null && list.contains(span.startPosition()))) {
              findMatches(new Match(match.startPosition(), span.endPosition()),
                  (n - 1));
              largestMatchingEndPosition = Math.max(largestMatchingEndPosition,
                  span.endPosition());
            }
          }
        }
      } else {
        // only unique spans
        if (!queueMatches.contains(match)) {
          queueMatches.add(match);
        }
      }
    }