Skip to content

Commit

Permalink
iter
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvg committed Feb 6, 2025
1 parent 1d0a210 commit c6cc1e7
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,18 @@ private Translog.Operation[] loadDocuments(List<SearchRecord> documentRecords) t
maxDoc = leafReaderContext.reader().maxDoc();
} while (docRecord.docID() >= docBase + maxDoc);

// TODO: instead of building an array, let's just check whether doc ids are (semi) dense
IntArrayList nextDocIds = new IntArrayList();
for (int j = i; j < documentRecords.size(); j++) {
int docID = documentRecords.get(j).docID();
if (docBase + maxDoc >= docID) {
break;
var record = documentRecords.get(j);
if (record.isTombstone()) {
continue;
}
int docID = record.docID();
if (docID >= docBase && docID < docBase + maxDoc) {
int segmentDocID = docID - docBase;
nextDocIds.add(segmentDocID);
}
int segmentDocID = docID - docBase;
nextDocIds.add(segmentDocID);
}

int[] nextDocIdArray = nextDocIds.toArray();
Expand Down

0 comments on commit c6cc1e7

Please sign in to comment.