The new Filter api allows to split the concerns of which data structure to use for collecting the docs in the DocIdSet and the cached data structure used to iterate over this set, and this is what shows up here.
For backward compatibility QueryWrapperFilter could use an OpenBitSet that is good for collecting the docids, but the new Filter api leaves it not really necessary to use a data structure at all (see my initial suggestion).
So the question is how we want to deal with the split between initial collecting and later repeated iterations. OpenBitSet is certainly good for collecting, so a good and backward compatible way would be to document the use of OpenBitSet in the javadocs of QueryWrapperFilter, and let CachingWrapperFilter decide later which data structure to cache.
The alternative would be to let CachingWrapperFilter always do the initial collecting , but that would not be backward compatible.
instanceof could be used to decide at CachingWrapperFilter to do this initial collecting when it's not sure that the given data structure allows repeated iteration, but it may be better to add a boolean method to DocIdSet that indicates whether the iterator can be used more than once or not. However, that is better left to
In short, I'd like to have a javadoc remark added to the original patch on the use of OpenBitSet, and leave the rest to