public static OpenBitSet getPrimeDocBitSet(Term primeDocTerm, IndexReader reader) throws IOException {
Object key = reader.getCoreCacheKey();
final Map<Object, OpenBitSet> primeDocMap = getPrimeDocMap(primeDocTerm);
OpenBitSet bitSet = primeDocMap.get(key);
if (bitSet == null) {
reader.addReaderClosedListener(new ReaderClosedListener() {
@Override
public void onClose(IndexReader reader) {
Object key = reader.getCoreCacheKey();
LOG.debug("Current size [" + primeDocMap.size() + "] Prime Doc BitSet removing for segment [" + reader + "]");
primeDocMap.remove(key);