org.apache.lucene.search.highlight.SimpleHTMLEncoder Java Examples

The following examples show how to use org.apache.lucene.search.highlight.SimpleHTMLEncoder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleFragmentsBuilderTest.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public void testTagsAndEncoder() throws Exception {
  FieldFragList ffl = ffl(new TermQuery(new Term(F, "a")), "<h1> a </h1>" );
  SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
  String[] preTags = { "[" };
  String[] postTags = { "]" };
  assertEquals( "&lt;h1&gt; [a] &lt;&#x2F;h1&gt;",
      sfb.createFragment( reader, 0, F, ffl, preTags, postTags, new SimpleHTMLEncoder() ) );
}
 
Example #2
Source File: HtmlEncoder.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public Encoder getEncoder(String fieldName, SolrParams params) {
  return new SimpleHTMLEncoder();
}