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

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


    assertFactingNotPresent(solrQuery);
  }

  @Test
  public void testConstructSolrQueryWithSingleGroupBy() {
    Query query = new SimpleQuery(new Criteria("field_1").is("value_1")).addGroupByField("group_1");
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNotNull(solrQuery);
    assertQueryStringPresent(solrQuery);
    assertPaginationNotPresent(solrQuery);
    assertProjectionNotPresent(solrQuery);
View Full Code Here


    assertFactingNotPresent(solrQuery);
  }

  @Test
  public void testConstructSolrQueryWithSingleFacetOnField() {
    Query query = new SimpleFacetQuery(new Criteria("field_1").is("value_1")).setFacetOptions(new FacetOptions(
        "facet_1"));
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNotNull(solrQuery);
    assertQueryStringPresent(solrQuery);
    assertPaginationNotPresent(solrQuery);
View Full Code Here

    assertFactingPresent(solrQuery, "facet_1");
  }

  @Test
  public void testConstructSolrQueryWithSinglePivot() {
    Query query = new SimpleFacetQuery(new Criteria("field_1").is("value_1")).setFacetOptions(new FacetOptions()
        .addFacetOnPivot("field_1", "field_2"));
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNotNull(solrQuery);
    assertQueryStringPresent(solrQuery);
    assertPaginationNotPresent(solrQuery);
View Full Code Here

    assertPivotFactingPresent(solrQuery, "field_1,field_2");
  }

  @Test
  public void testConstructSolrQueryWithMultipleFacetOnFields() {
    FacetQuery query = new SimpleFacetQuery(new Criteria("field_1").is("value_1")).setFacetOptions(new FacetOptions(
        "facet_1", "facet_2"));
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNotNull(solrQuery);
    assertQueryStringPresent(solrQuery);
    assertPaginationNotPresent(solrQuery);
View Full Code Here

    assertFactingPresent(solrQuery, "facet_1", "facet_2");
  }

  @Test
  public void testConstructSolrQueryWithMultiplePivot() {
    FacetQuery query = new SimpleFacetQuery(new Criteria("field_1").is("value_1")).setFacetOptions(new FacetOptions()
        .addFacetOnPivot("field_1", "field_2").addFacetOnPivot("field_2", "field_3"));
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNotNull(solrQuery);
    assertQueryStringPresent(solrQuery);
    assertPaginationNotPresent(solrQuery);
View Full Code Here

    assertPivotFactingPresent(solrQuery, "field_1,field_2", "field_2,field_3");
  }

  @Test
  public void testConstructSolrQueryWithFacetPrefix() {
    FacetQuery query = new SimpleFacetQuery(new Criteria("field_1").is("value_1"));
    FacetOptions facetOptions = new FacetOptions(new SimpleField("facet_1"), new SimpleField("facet_2"));
    facetOptions.setFacetPrefix("prefix");
    query.setFacetOptions(facetOptions);

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
View Full Code Here

    Assert.assertEquals(facetOptions.getFacetPrefix(), solrQuery.getParams("facet.prefix")[0]);
  }

  @Test
  public void testConstructSolrQueryWithFieldFacetParameters() {
    FacetQuery query = new SimpleFacetQuery(new Criteria("field_1").is("value_1"));
    FieldWithFacetParameters fieldWithFacetParameters = new FieldWithFacetParameters("facet_2").setPrefix("prefix")
        .setSort(FacetSort.INDEX).setLimit(3).setOffset(2).setMethod("method").setMissing(true);
    FacetOptions facetOptions = new FacetOptions(new SimpleField("facet_1"), fieldWithFacetParameters);
    query.setFacetOptions(facetOptions);
View Full Code Here

        solrQuery.getParams("f." + fieldWithFacetParameters.getName() + ".facet.missing")[0]);
  }

  @Test
  public void testConstructSolrQueryWithCustomFieldFacetParameters() {
    FacetQuery query = new SimpleFacetQuery(new Criteria("field_1").is("value_1"));
    FieldWithFacetParameters fieldWithFacetParameters = new FieldWithFacetParameters("facet_2")
        .addFacetParameter(new FacetParameter(FacetParams.FACET_ZEROS, "on"));
    FacetOptions facetOptions = new FacetOptions(new SimpleField("facet_1"), fieldWithFacetParameters);
    query.setFacetOptions(facetOptions);
View Full Code Here

    Assert.assertEquals("on", solrQuery.getParams("f." + fieldWithFacetParameters.getName() + ".facet.zeros")[0]);
  }

  @Test
  public void testConstructSolrQueryWithFacetSort() {
    FacetQuery query = new SimpleFacetQuery(new Criteria("field_1").is("value_1")).setFacetOptions(new FacetOptions(
        "facet_1").setFacetSort(FacetOptions.FacetSort.INDEX));
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertEquals("index", solrQuery.getFacetSortString());

    query.getFacetOptions().setFacetSort(FacetOptions.FacetSort.COUNT);
View Full Code Here

    Assert.assertEquals("count", solrQuery.getFacetSortString());
  }

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

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

TOP

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

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.