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

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


    Assert.assertEquals("{!join from=inner_id to=outer_id}field_1:value_1", solrQuery.getQuery());
  }

  @Test
  public void testConstructSolrQueryWithEmptyHighlightOption() {
    SimpleHighlightQuery query = new SimpleHighlightQuery(new SimpleStringCriteria("field_1:value_1"));
    query.setHighlightOptions(new HighlightOptions());

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertTrue(solrQuery.getHighlight());
    Assert.assertArrayEquals(new String[] { Criteria.WILDCARD }, solrQuery.getHighlightFields());
View Full Code Here


    Assert.assertArrayEquals(new String[] { Criteria.WILDCARD }, solrQuery.getHighlightFields());
  }

  @Test
  public void testConstructSolrQueryWithoutHighlightOption() {
    SimpleHighlightQuery query = new SimpleHighlightQuery(new SimpleStringCriteria("field_1:value_1"));

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertFalse(solrQuery.getHighlight());
  }
View Full Code Here

    Assert.assertFalse(solrQuery.getHighlight());
  }

  @Test
  public void testConstructSolrQueryWithHighlightOptionHavingFields() {
    SimpleHighlightQuery query = new SimpleHighlightQuery(new SimpleStringCriteria("field_1:value_1"));
    HighlightOptions options = new HighlightOptions();
    options.addField("field_2", "field_3");
    query.setHighlightOptions(options);

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

    Assert.assertArrayEquals(new String[] { "field_2", "field_3" }, solrQuery.getHighlightFields());
  }

  @Test
  public void testConstructSorlQueryWithHighlightOptionFragsize() {
    SimpleHighlightQuery query = new SimpleHighlightQuery(new SimpleStringCriteria("field_1:value_1"));
    HighlightOptions options = new HighlightOptions();
    options.setFragsize(10);
    query.setHighlightOptions(options);

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

  @Test
  public void testConvertFacetQueryResponseForQueryResultWithNullFacetQueries() {
    Mockito.when(response.getFacetQuery()).thenReturn(null);
    List<FacetQueryEntry> result = ResultHelper.convertFacetQueryResponseToFacetQueryResult(
        createFacetQuery(new SimpleQuery(new SimpleStringCriteria("field_1:[* TO 5]"))), response);
    Assert.assertNotNull(result);
    Assert.assertTrue(result.isEmpty());
  }
View Full Code Here

  @Test
  public void testConvertFacetQueryResponseForQueryResultWithEmptyFacetQueries() {
    Mockito.when(response.getFacetQuery()).thenReturn(Collections.<String, Integer> emptyMap());
    List<FacetQueryEntry> result = ResultHelper.convertFacetQueryResponseToFacetQueryResult(
        createFacetQuery(new SimpleQuery(new SimpleStringCriteria("field_1:[* TO 5]"))), response);
    Assert.assertNotNull(result);
    Assert.assertTrue(result.isEmpty());
  }
View Full Code Here

    resultMap.put("field_1:[* TO 5]", 5);
    resultMap.put("field_1:[6 TO *]", 10);

    Mockito.when(response.getFacetQuery()).thenReturn(resultMap);
    List<FacetQueryEntry> result = ResultHelper.convertFacetQueryResponseToFacetQueryResult(
        createFacetQuery(new SimpleQuery(new SimpleStringCriteria("field_1:[* TO 5]")), new SimpleQuery(
            new SimpleStringCriteria("field_1:[6 TO *]"))), response);
    Assert.assertNotNull(result);
    Assert.assertEquals(2, result.size());

    Assert.assertEquals(5, result.get(0).getValueCount());
    Assert.assertEquals("field_1:[* TO 5]", result.get(0).getValue());
View Full Code Here

    nl.add("sumOfSquares", sumOfSquares);
    return nl;
  }

  private FacetQuery createFacetQuery(SolrDataQuery... facetQueries) {
    FacetQuery fq = new SimpleFacetQuery(new SimpleStringCriteria("*:*"));
    fq.setFacetOptions(new FacetOptions(facetQueries));
    return fq;
  }
View Full Code Here

TOP

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

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.