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

Examples of org.springframework.data.solr.core.query.FacetOptions$FacetParameter


  @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);

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


  @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);

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertEquals("on", solrQuery.getParams("f." + fieldWithFacetParameters.getName() + ".facet.zeros")[0]);
  }
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

    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);
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.core.query.FacetOptions$FacetParameter

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.