I am about to write a Filter that only operates on a set of documents that have already passed other filter(s). It's rather expensive, since it has to use DocValues to examine a value and then determine if its a match. So it scales O(n) where n is the number of documents it must see. The 2nd arg of getDocIdSet is Bits acceptDocs. Unfortunately Bits doesn't have an int iterator but I can deal with that seeing if it extends DocIdSet.
I'm looking at BooleanFilter which I want to use and I notice that it passes null to filter.getDocIdSet for acceptDocs, and it justifies this with the following comment: // we dont pass acceptDocs, we will filter at the end using an additional filter Uwe wrote this comment in relation to LUCENE-1536 (r1188624). For the MUST clause loop, couldn't it give it the accumulated bits of the MUST clauses? ~ David