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

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


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

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


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

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

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

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

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

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

  @Test
  public void testCreateQueryWithLikeClauseUsingCollection() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleLike", 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 testCreateQueryWithArrayType() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByPopularityLike", String[].class);

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

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

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

  @Test
  public void testCreateQueryWithLikeNotClauseUsingCollection() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleNotLike", 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 testCreateQueryWithStartsWithClause() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleStartingWith", String.class);

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

  @Test
  public void testCreateQueryWithStartsWithClauseUsingCollection() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByTitleStartingWith", 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

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.