} else {
return EmptyDocIdSet.getInstance();
}
}
Collections.sort(docidList);
final IntArrayDocIdSet intArraySet = new IntArrayDocIdSet(docidList.size());
boolean deletesPresent = delDocIds != null && delDocIds.length > 0;
for (int docid : docidList){
if (!deletesPresent || Arrays.binarySearch(delDocIds,docid) < 0) {
intArraySet.addDoc(docid);
}
}
return new RandomAccessDocIdSet(){
@Override
public boolean get(int docid) {
return docidList.contains(docid);
}
@Override
public DocIdSetIterator iterator() throws IOException {
return intArraySet.iterator();
}
};
}
};
}