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

Examples of org.springframework.data.solr.core.query.HighlightOptions$HighlightParameter


  }

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

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertEquals(options.getFormatter(), solrQuery.getParams(HighlightParams.FORMATTER)[0]);
  }
View Full Code Here


  }

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

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertEquals(options.getNrSnipplets().intValue(), solrQuery.getHighlightSnippets());
  }
View Full Code Here

  }

  @Test
  public void testConstructSorlQueryWithHighlightOptionsAndAnySolrParameter() {
    SimpleHighlightQuery query = new SimpleHighlightQuery(new SimpleStringCriteria("field_1:value_1"));
    HighlightOptions options = new HighlightOptions();
    options.addHighlightParameter(HighlightParams.SIMPLE_PRE, "{pre}");
    query.setHighlightOptions(options);

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertEquals(options.<String> getHighlightParameterValue(HighlightParams.SIMPLE_PRE),
        solrQuery.getHighlightSimplePre());
  }
View Full Code Here

  }

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

    HighlightOptions.FieldWithHighlightParameters fieldWithHighlightParameters = new HighlightOptions.FieldWithHighlightParameters(
        "field_2");
    fieldWithHighlightParameters.setFormatter("formatter");
    fieldWithHighlightParameters.setFragsize(10);

    options.addField(fieldWithHighlightParameters);
    query.setHighlightOptions(options);

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertArrayEquals(new String[] { "field_2" }, solrQuery.getHighlightFields());
    Assert.assertEquals(fieldWithHighlightParameters.getFormatter(),
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.core.query.HighlightOptions$HighlightParameter

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.