return random().nextBoolean();
}
};
// First search, no drill downs:
DrillDownQuery ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
DrillSidewaysResult dsr = ds.search(null, ddq, 10, fsp);
assertEquals(100, dsr.hits.totalHits);
assertEquals(2, dsr.facetResults.size());
assertEquals("dim (0)\n b (75)\n a (25)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(0)));
assertEquals("field (0)\n less than 10 (10)\n less than or equal to 10 (11)\n over 90 (9)\n 90 or above (10)\n over 1000 (0)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(1)));
// Second search, drill down on dim=b:
ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
ddq.add(new CategoryPath("dim", "b"));
dimSeen.clear();
dsr = ds.search(null, ddq, 10, fsp);
assertEquals(75, dsr.hits.totalHits);
assertEquals(2, dsr.facetResults.size());
assertEquals("dim (0)\n b (75)\n a (25)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(0)));
assertEquals("field (0)\n less than 10 (7)\n less than or equal to 10 (8)\n over 90 (7)\n 90 or above (8)\n over 1000 (0)\n", FacetTestUtils.toSimpleString(dsr.facetResults.get(1)));
// Third search, drill down on "less than or equal to 10":
ddq = new DrillDownQuery(FacetIndexingParams.DEFAULT, new MatchAllDocsQuery());
ddq.add("field", NumericRangeQuery.newLongRange("field", 0L, 10L, true, true));
dimSeen.clear();
dsr = ds.search(null, ddq, 10, fsp);
assertEquals(11, dsr.hits.totalHits);
assertEquals(2, dsr.facetResults.size());