@Override public int nextDoc() throws IOException { assertThread("Sorted doc values", creationThread); int docID = in.nextDoc(); assert docID > lastDocID; assert docID == NO_MORE_DOCS || docID < maxDoc; assert docID == in.docID(); lastDocID = docID; return docID; }
private int[] sortDocValues(int maxDoc, Sorter.DocMap sortMap, SortedDocValues oldValues) throws IOException { int[] ords = new int[maxDoc]; Arrays.fill(ords, -1); int docID; while ((docID = oldValues.nextDoc()) != NO_MORE_DOCS) { int newDocID = sortMap.oldToNew(docID); ords[newDocID] = oldValues.ordValue(); } return ords; }