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

Examples of org.springframework.data.solr.core.query.Criteria$Predicate


    Assert.assertArrayEquals(new String[] { "field_2:[* TO 5]" }, solrQuery.getFacetQuery());
  }

  @Test
  public void testConstructSolrQueryWithMultipleFacetFilterQuerues() {
    FacetQuery query = new SimpleFacetQuery(new Criteria("field_1").is("value_1")).setFacetOptions(new FacetOptions()
        .addFacetQuery(new SimpleQuery(new SimpleStringCriteria("field_2:[* TO 5]"))).addFacetQuery(
            new SimpleQuery(new Criteria("field_3").startsWith("prefix"))));

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNotNull(solrQuery);
    assertQueryStringPresent(solrQuery);
    assertPaginationNotPresent(solrQuery);
View Full Code Here


    Assert.assertArrayEquals(new String[] { "field_2:[* TO 5]", "field_3:prefix*" }, solrQuery.getFacetQuery());
  }

  @Test
  public void testWithFilterQuery() {
    Query query = new SimpleQuery(new Criteria("field_1").is("value_1")).addFilterQuery(new SimpleFilterQuery(
        new Criteria("filter_field").is("filter_value")));
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);

    String[] filterQueries = solrQuery.getFilterQueries();
    Assert.assertEquals(1, filterQueries.length);
    Assert.assertEquals("filter_field:filter_value", filterQueries[0]);
View Full Code Here

    Assert.assertEquals("filter_field:filter_value", filterQueries[0]);
  }

  @Test
  public void testWithEmptyFilterQuery() {
    Query query = new SimpleQuery(new Criteria("field_1").is("value_1")).addFilterQuery(new SimpleQuery());
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);

    Assert.assertNull(solrQuery.getFilterQueries());
  }
View Full Code Here

   * @see DATASOLR-105
   */
  @Test
  public void testNestedOrPartWithAnd() {

    Criteria criteria = Criteria.where("field_1").is("foo")
        .and(Criteria.where("field_2").is("bar").or("field_3").is("roo"))//
        .or(Criteria.where("field_4").is("spring").and("field_5").is("data"));

    Assert.assertEquals("field_1:foo AND (field_2:bar OR field_3:roo) OR (field_4:spring AND field_5:data)",
        queryParser.createQueryStringFromNode(criteria));
View Full Code Here

   * @see DATASOLR-105
   */
  @Test
  public void testNestedOrPartWithAndSomeOtherThings() {

    Criteria criteria = Criteria.where("field_1").is("foo").is("bar")
        .and(Criteria.where("field_2").is("bar").is("lala").or("field_3").is("roo"))
        .or(Criteria.where("field_4").is("spring").and("field_5").is("data"));

    Assert.assertEquals(
        "field_1:(foo bar) AND (field_2:(bar lala) OR field_3:roo) OR (field_4:spring AND field_5:data)",
View Full Code Here

  /**
   * @see DATASOLR-105
   */
  @Test
  public void testMultipleAnd() {
    Criteria criteria = Criteria.where("field_1").is("foo").and("field_2").is("bar").and("field_3").is("roo");

    Assert.assertEquals("field_1:foo AND field_2:bar AND field_3:roo", queryParser.createQueryStringFromNode(criteria));
  }
View Full Code Here

  /**
   * @see DATASOLR-105
   */
  @Test
  public void testMultipleOr() {
    Criteria criteria = Criteria.where("field_1").is("foo").or("field_2").is("bar").or("field_3").is("roo");

    Assert.assertEquals("field_1:foo OR field_2:bar OR field_3:roo", queryParser.createQueryStringFromNode(criteria));
  }
View Full Code Here

  /**
   * @see DATASOLR-105
   */
  @Test
  public void testEmptyCriteriaShouldBeDefaultedToNotNUll() {
    Criteria criteria = Criteria.where("field_1").is("foo").and("field_2").or("field_3");

    Assert.assertEquals("field_1:foo AND field_2:[* TO *] OR field_3:[* TO *]",
        queryParser.createQueryStringFromNode(criteria));
  }
 
View Full Code Here

   * @see DATASOLR-105
   */
  @Test
  public void testDeepNesting() {

    Criteria criteria = Criteria.where("field_1").is("foo")
        .and(Criteria.where("field_2").is("bar").and("field_3").is("roo")//
            .and(Criteria.where("field_4").is("spring").and("field_5").is("data").or("field_6").is("solr")));

    Assert.assertEquals(
        "field_1:foo AND (field_2:bar AND field_3:roo AND (field_4:spring AND field_5:data OR field_6:solr))",
View Full Code Here

   * @see DATASOLR-168
   */
  @Test
  public void testNotCritieraCarriedOnPorperlyForNullAndNotNull() {

    Criteria criteria = new Criteria("param1").isNotNull().and("param2").isNull();
    Assert.assertEquals("param1:[* TO *] AND -param2:[* TO *]", queryParser.createQueryStringFromNode(criteria));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.core.query.Criteria$Predicate

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.