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

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


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

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


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

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

  @Test
  public void testCreateQueryWithInClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByPopularityIn", Integer[].class);

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

  @Test
  public void testCreateQueryWithNotInClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByPopularityNotIn", Integer[].class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { new Object[] { 1, 2, 3 } });
    Assert.assertEquals("-popularity:(1 2 3)", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithNear() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLocationNear", Point.class, Distance.class);

    Query query = createQueryForMethodWithArgs(method,
        new Object[] { new Point(48.303056, 14.290556), new Distance(5) });
    Assert.assertEquals("{!bbox pt=48.303056,14.290556 sfield=store d=5.0}", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithNearWhereUnitIsMiles() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLocationNear", Point.class, Distance.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { new Point(48.303056, 14.290556),
        new Distance(1, Metrics.MILES) });
    Assert.assertEquals("{!bbox pt=48.303056,14.290556 sfield=store d=1.609344}", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithWithin() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLocationWithin", Point.class, Distance.class);

    Query query = createQueryForMethodWithArgs(method,
        new Object[] { new Point(48.303056, 14.290556), new Distance(5) });
    Assert.assertEquals("{!geofilt pt=48.303056,14.290556 sfield=store d=5.0}", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithWithinWhereUnitIsMiles() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLocationWithin", Point.class, Distance.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { new Point(48.303056, 14.290556),
        new Distance(1, Metrics.MILES) });
    Assert.assertEquals("{!geofilt pt=48.303056,14.290556 sfield=store d=1.609344}", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithNearUsingBox() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLocationNear", Box.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { new Box(new Point(48.303056, 14.290556),
        new Point(48.306377, 14.283128)) });
    Assert.assertEquals("store:[48.303056,14.290556 TO 48.306377,14.283128]", queryParser.getQueryString(query));
  }
View Full Code Here

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

    Query query = createQueryForMethodWithArgs(method, new Object[] { 1 });
    Assert.assertNotNull(query.getSort());
    Assert.assertEquals(Sort.Direction.DESC, query.getSort().getOrderFor("title").getDirection());
  }
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.