public BitSet bits(IndexReader reader) throws IOException {
if (chainedFilters.size() == 0) throw new AssertionFailure("Chainedfilter has no filters to chain for");
//we need to copy the first BitSet because BitSet is modified by .logicalOp
Filter filter = chainedFilters.get( 0 );
BitSet result = (BitSet) filter.bits( reader ).clone();
for (int index = 1 ; index < chainedFilters.size() ; index++) {
result.and( chainedFilters.get( index ).bits( reader ) );
}
return result;
}