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

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


    Assert.assertNotNull(solrQuery.get("defType"));
  }

  @Test
  public void testWithUndefindedDefType() {
    SimpleQuery query = new SimpleQuery(new SimpleStringCriteria("field_1:value_1"));
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNull(solrQuery.get("defType"));
  }
View Full Code Here


    Assert.assertNull(solrQuery.get("defType"));
  }

  @Test
  public void testWithFooRequestHandler() {
    SimpleQuery query = new SimpleQuery(new SimpleStringCriteria("field_1:value_1"));
    query.setRequestHandler("/foo");
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNotNull(solrQuery.get("qt"));
  }
View Full Code Here

    Assert.assertNotNull(solrQuery.get("qt"));
  }

  @Test
  public void testWithUndefinedRequestHandler() {
    SimpleQuery query = new SimpleQuery(new SimpleStringCriteria("field_1:value_1"));
    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNull(solrQuery.get("qt"));
  }
View Full Code Here

    Assert.assertNull(solrQuery.get("qt"));
  }

  @Test
  public void testWithJoinOperator() {
    SimpleQuery query = new SimpleQuery(new SimpleStringCriteria("field_1:value_1"));
    query.setJoin(Join.from("inner_id").to("outer_id"));

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertEquals("{!join from=inner_id to=outer_id}field_1:value_1", solrQuery.getQuery());
  }
View Full Code Here

   * @see DATASOLR-112
   */
  @Test
  public void pageableUsingZeroShouldBeParsedCorrectlyWhenSetUsingPageable() {

    SimpleQuery query = new SimpleQuery("*:*").setPageRequest(new SolrPageRequest(0, 0));
    assertPaginationPresent(queryParser.constructSolrQuery(query), 0, 0);
  }
View Full Code Here

   * @see DATASOLR-112
   */
  @Test
  public void pageableUsingZeroShouldBeParsedCorrectlyWhenSetUsingExplititMethods() {

    SimpleQuery query = new SimpleQuery("*:*").setOffset(0).setRows(0);
    assertPaginationPresent(queryParser.constructSolrQuery(query), 0, 0);
  }
View Full Code Here

   */
  @Test
  public void testConstructSolrQueryWithStatField() {
    StatsOptions statsOptions = new StatsOptions().addField(new SimpleField("field_1"));

    SimpleQuery query = new SimpleQuery("*:*");
    query.setStatsOptions(statsOptions);

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);

    Assert.assertEquals("field_1", solrQuery.get(StatsParams.STATS_FIELD));
  }
View Full Code Here

  public void testConstructSolrQueryWithStatFields() {
    StatsOptions statsOptions = new StatsOptions()//
        .addField(new SimpleField("field_1"))//
        .addField(new SimpleField("field_2"));

    SimpleQuery query = new SimpleQuery("*:*");
    query.setStatsOptions(statsOptions);

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);

    List<String> fields = Arrays.asList(solrQuery.getParams(StatsParams.STATS_FIELD));
    Collections.sort(fields);
View Full Code Here

  public void testConstructSolrQueryWithStatFacets() {
    StatsOptions statsOptions = new StatsOptions()//
        .addFacet(new SimpleField("field_1"))//
        .addFacet(new SimpleField("field_2"));

    SimpleQuery query = new SimpleQuery("*:*");
    query.setStatsOptions(statsOptions);

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);

    List<String> facets = Arrays.asList(solrQuery.getParams(StatsParams.STATS_FACET));
    Collections.sort(facets);
View Full Code Here

  public void testConstructSolrQueryWithStatFieldsAndFacets() {
    StatsOptions statsOptions = new StatsOptions()//
        .addField(new SimpleField("field_1"))//
        .addFacet(new SimpleField("field_2"));

    SimpleQuery query = new SimpleQuery("*:*");
    query.setStatsOptions(statsOptions);

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);

    String[] fields = solrQuery.getParams(StatsParams.STATS_FIELD);
    String[] facets = solrQuery.getParams(StatsParams.STATS_FACET);
View Full Code Here

TOP

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

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.