private static final long[] EMPTY_LONG_ARRAY = new long[]{};
public static long[] getDocidsForIdTerms(byte[][] idTerms, BagIndex index, long revNum) {
if (idTerms.length == 0) return EMPTY_LONG_ARRAY;
long[] docIds = new long[idTerms.length];
Scanner idScanner = disjunctiveScannerFromTerms(idTerms, index, revNum);
Scanner delScanner = index.fetchDeletions(revNum);
Scanner scanner = ScannerUtil.andNotScanner(idScanner, delScanner);
while (scanner.next()) {
long docId = scanner.doc();
for(int i = 0; i < idTerms.length; i++) {
if (scanner.knownToHaveTerm(idTerms[i]))
docIds[i] = docId;
}
}
return docIds;
}