@Test public void testAnnotatedQueryUsageWithoutExplicitAttribute() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByAnnotatedQueryWithoutExplicitAttribute", String.class); Assert.assertTrue(method.hasAnnotatedQuery()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals("name:?0", method.getAnnotatedQuery()); }
@Test public void testAnnotatedQueryUsage() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByAnnotatedQuery", String.class); Assert.assertTrue(method.hasAnnotatedQuery()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertFalse(method.hasProjectionFields()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals("name:?0", method.getAnnotatedQuery()); }
@Test public void testWithMultipleFieldsProjection() throws Exception { SolrQueryMethod method = getQueryMethodByName("findByAnnotatedQueryWithProjectionOnMultipleFields", String.class); Assert.assertTrue(method.hasAnnotatedQuery()); Assert.assertTrue(method.hasProjectionFields()); Assert.assertFalse(method.hasFilterQuery()); Assert.assertEquals(2, method.getProjectionFields().size()); Assert.assertFalse(method.hasAnnotatedNamedQueryName()); Assert.assertEquals("name:?0", method.getAnnotatedQuery()); }
public StringBasedSolrQuery(SolrQueryMethod method, SolrOperations solrOperations) { this(method.getAnnotatedQuery(), method, solrOperations); }