@Test public void testFacetWithParametrizedQuery() { FacetPage<ProductBean> facetPage = repo.findAllFacetQueryPopularity(3, new PageRequest(0, 10)); Assert.assertEquals(0, facetPage.getFacetFields().size()); Page<FacetQueryEntry> facets = facetPage.getFacetQueryResult(); Assert.assertEquals(1, facets.getContent().size()); Assert.assertEquals("popularity:[* TO 3]", facets.getContent().get(0).getValue()); Assert.assertEquals(3, facets.getContent().get(0).getValueCount()); }
@Test public void testFacetOnMulipleQueries() { FacetPage<ProductBean> facetPage = repo.findAllFacetQueryAvailableTrueAndAvailableFalse(new PageRequest(0, 10)); Assert.assertEquals(0, facetPage.getFacetFields().size()); Page<FacetQueryEntry> facets = facetPage.getFacetQueryResult(); Assert.assertEquals(2, facets.getContent().size()); Assert.assertEquals("inStock:true", facets.getContent().get(0).getValue()); Assert.assertEquals(3, facets.getContent().get(0).getValueCount()); Assert.assertEquals("inStock:false", facets.getContent().get(1).getValue()); Assert.assertEquals(1, facets.getContent().get(1).getValueCount()); }