private void advanceAllTo(int docId) {
        int i = 0;
        int completedCount = 0;
        for (; i < nPostingLists; ++i) {
            if (docIds[sortedIndexes[i]] >= docId) {
                break;
            }
            if (!advanceOneTo(docId, i)) {
                ++completedCount;
            }
        }
        // No need to sort if all posting lists are finished.
        if (i > 0 && nPostingLists > completedCount) {
            sortIndexes(i);
            // Decrement the number of posting lists.
        }
        nPostingLists -= completedCount;
    }
Returns the end value of the interval,
or -1 if the highest end value seen is less than the interval begin.
predicate-search/src/main/java/com/yahoo/search/predicate/index/PredicateSearch.java