Package org.springframework.data.solr.core.query

Examples of org.springframework.data.solr.core.query.Query


  @Test
  public void testCreateQueryWithEndingWithClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleEndingWith", String.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { "christoph" });
    Assert.assertEquals("title:*christoph", queryParser.getQueryString(query));
  }
View Full Code Here


  @Test
  public void testCreateQueryWithEndingWithClauseUsingCollection() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleEndingWith", Collection.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { Arrays.asList("one", "two", "three") });
    Assert.assertEquals("title:(*one *two *three)", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithContainingClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleContaining", String.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { "solr" });
    Assert.assertEquals("title:*solr*", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithContainingClauseUsingCollection() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleContaining", Collection.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { Arrays.asList("one", "two", "three") });
    Assert.assertEquals("title:(*one* *two* *three*)", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithRegexClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleRegex", String.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { "(\\+ \\*)" });
    Assert.assertEquals("title:(\\+ \\*)", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithBetweenClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByPopularityBetween", Integer.class, Integer.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { 100, 200 });
    Assert.assertEquals("popularity:[100 TO 200]", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithBeforeClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLastModifiedBefore", Date.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { new DateTime(2012, 10, 15, 5, 31, 0,
        DateTimeZone.UTC) });
    Assert.assertEquals("last_modified:[* TO 2012\\-10\\-15T05\\:31\\:00.000Z}", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithLessThanClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByPriceLessThan", Float.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { 100f });
    Assert.assertEquals("price:[* TO 100.0}", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithLessThanEqualsClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByPriceLessThanEqual", Float.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { 100f });
    Assert.assertEquals("price:[* TO 100.0]", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithAfterClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLastModifiedAfter", Date.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { new DateTime(2012, 10, 15, 5, 31, 0,
        DateTimeZone.UTC) });
    Assert.assertEquals("last_modified:{2012\\-10\\-15T05\\:31\\:00.000Z TO *]", queryParser.getQueryString(query));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.core.query.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.