list.add(s);
randomAccessList.add(s);
}
final RandomAccessDocIdSet[] randomAccessDocIdSets = randomAccessList
.toArray(new RandomAccessDocIdSet[randomAccessList.size()]);
final DocIdSet orDocIdSet = new OrDocIdSet(list);
return new RandomAccessDocIdSet() {
@Override
public boolean get(int docId) {
for (RandomAccessDocIdSet s : randomAccessDocIdSets) {
if (s.get(docId)) return true;
}
return false;
}
@Override
public DocIdSetIterator iterator() throws IOException {
return orDocIdSet.iterator();
}
};
}
}