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

The following examples show how to use org.apache.lucene.search.highlight.SimpleHTMLEncoder. These examples are extracted from open source projects. 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 Project: lucene-solr   Source File: SimpleFragmentsBuilderTest.java    License: 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 Project: lucene-solr   Source File: HtmlEncoder.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Encoder getEncoder(String fieldName, SolrParams params) {
  return new SimpleHTMLEncoder();
}