@Test public void testWithSingleFieldFacet() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByNameFacetOnPopularity", String.class); Assert.assertFalse(method.hasAnnotatedQuery()); Assert.assertFalse(method.hasProjectionFields()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertTrue(method.hasFacetFields()); Assert.assertFalse(method.hasFacetQueries()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals(1, method.getFacetFields().size()); Assert.assertEquals(Integer.valueOf(10), method.getFacetLimit()); Assert.assertEquals(Integer.valueOf(1), method.getFacetMinCount()); }
@Test public void testWithMultipleFieldFacetsLimitAndMinCount() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByNameFacetOnPopularityAndPriceMinCount3Limit25", String.class); Assert.assertFalse(method.hasAnnotatedQuery()); Assert.assertFalse(method.hasProjectionFields()); Assert.assertTrue(method.hasFacetFields()); Assert.assertFalse(method.hasFacetQueries()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals(2, method.getFacetFields().size()); Assert.assertEquals(Integer.valueOf(25), method.getFacetLimit()); Assert.assertEquals(Integer.valueOf(3), method.getFacetMinCount()); }
@Test public void testWithMultipleFieldPivotsLimitAndMinCount() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByNamePivotOnField1VsField2AndField2VsField3AndLimitAndMinCount"); Assert.assertFalse(method.hasAnnotatedQuery()); Assert.assertFalse(method.hasProjectionFields()); Assert.assertFalse(method.hasFacetFields()); Assert.assertTrue(method.hasPivotFields()); Assert.assertFalse(method.hasFacetQueries()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals(2, method.getPivotFields().size()); Assert.assertEquals(Integer.valueOf(25), method.getFacetLimit()); Assert.assertEquals(Integer.valueOf(3), method.getFacetMinCount()); }
@Test public void testWithMultipleQueryFacets() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByNameFacetOnAvailableQuery", String.class); Assert.assertFalse(method.hasAnnotatedQuery()); Assert.assertFalse(method.hasProjectionFields()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertFalse(method.hasFacetFields()); Assert.assertTrue(method.hasFacetQueries()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals(0, method.getFacetFields().size()); Assert.assertEquals(2, method.getFacetQueries().size()); Assert.assertEquals(Integer.valueOf(10), method.getFacetLimit()); Assert.assertEquals(Integer.valueOf(1), method.getFacetMinCount()); Assert.assertEquals("inStock:true", method.getFacetQueries().get(0)); Assert.assertEquals("inStock:false", method.getFacetQueries().get(1)); }