@Test
public void testSenseiTermFilter() throws IOException {
SenseiTermFilter orTermFilter =
new SenseiTermFilter("column", vals, null, false, false);
BoboIndexReader indexReader = createMock(BoboIndexReader.class);
MultiValueFacetDataCache facetDataCache =
new MultiValueFacetDataCache();
facetDataCache.valArray = dictionary;
facetDataCache.freqs = freqs;
FacetHandler facetHandler =
new MultiValueFacetHandler("column", 32);
expect(indexReader.maxDoc()).andReturn(1000).anyTimes();
expect(indexReader.getFacetHandler("column")).andReturn(facetHandler);
expect(indexReader.getFacetData("column")).andReturn(facetDataCache).anyTimes();
replay(indexReader);
SenseiDocIdSet orDocIdSet = orTermFilter.getSenseiDocIdSet(indexReader);
DocSetAssertions.assertRange(26, 72, 1000, orDocIdSet.getCardinalityEstimate());
SenseiTermFilter andTermFilter =
new SenseiTermFilter("column", vals, null, true, false);
reset(indexReader);
expect(indexReader.maxDoc()).andReturn(1000).anyTimes();
expect(indexReader.getFacetHandler("column")).andReturn(facetHandler);
expect(indexReader.getFacetData("column")).andReturn(facetDataCache).anyTimes();
replay(indexReader);
SenseiDocIdSet andDocIdSet = andTermFilter.getSenseiDocIdSet(indexReader);
DocSetAssertions.assertRange(0, 22, 1000, andDocIdSet.getCardinalityEstimate());
}