}
}
LeafReader reader = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(w, true));
w.close();
TermsFilter tf = new TermsFilter(new Term[]{new Term(fieldName, "19")});
assertNull(tf.getDocIdSet(reader.getContext(), reader.getLiveDocs()));
tf = new TermsFilter(new Term[]{new Term(fieldName, "19"), new Term(fieldName, "20")});
DocIdSet result = tf.getDocIdSet(reader.getContext(), reader.getLiveDocs());
BitSet bits = DocIdSets.toBitSet(result.iterator(), reader.maxDoc());
assertThat(bits.cardinality(), equalTo(1));
tf = new TermsFilter(new Term[]{new Term(fieldName, "19"), new Term(fieldName, "20"), new Term(fieldName, "10")});
result = tf.getDocIdSet(reader.getContext(), reader.getLiveDocs());
bits = DocIdSets.toBitSet(result.iterator(), reader.maxDoc());
assertThat(bits.cardinality(), equalTo(2));
tf = new TermsFilter(new Term[]{new Term(fieldName, "19"), new Term(fieldName, "20"), new Term(fieldName, "10"), new Term(fieldName, "00")});
result = tf.getDocIdSet(reader.getContext(), reader.getLiveDocs());
bits = DocIdSets.toBitSet(result.iterator(), reader.maxDoc());
assertThat(bits.cardinality(), equalTo(2));
reader.close();
rd.close();