@Test public void testFacetQuery() { FacetPage<Product> facetPage = repo.findProductCategoryFacets(new PageRequest(0, 100)); Assert.assertEquals(repo.findAllProducts().size(), facetPage.getNumberOfElements()); Page<FacetFieldEntry> page = facetPage.getFacetResultPage(SolrProductField.CATEGORY); Assert.assertEquals(INITIAL_CATEGORY_COUNT, page.getNumberOfElements()); for (FacetFieldEntry entry : page) { Assert.assertEquals(SolrProductField.CATEGORY.getName(), entry.getField().getName()); Assert.assertEquals(repo.findByCategory(entry.getValue()).size(), entry.getValueCount()); } }
@Override public List<Product> getProductsByQuery() { logger.debug("Retrieving all products by solr @Query"); return productRepo.findAllProducts(); }