for (int i=0;i<100;++i)
{
set1.addDoc(2*i); // 100 even numbers
}
DocIdSetIterator filteredIter = new FilteredDocSetIterator(set1.iterator())
{
@Override
protected boolean match(int doc)
{
return doc%5 == 0;
}
};
BitSet bs = new BitSet();
for (int i=0;i<100;++i)
{
int n = 10*i;
if (n < 200)
{
bs.set(n);
}
}
try
{
int doc;
while((doc=filteredIter.nextDoc())!=DocIdSetIterator.NO_MORE_DOCS)
{
if (!bs.get(doc)){
fail("failed: "+doc+" not in expected set");
return;
}