title: Lucene.NET Search Highlighting that respects HTML Tags
body: <p>I am trying to highlight search terms in a block of HTML, the problem is if a user does a search for "color", this:</p>
  
  <p>&lt;span style='color: white'&gt;White&lt;/span&gt;</p>
  
  <p>becomes:
  &lt;span style='<strong>&lt;b&gt;color&lt;/b&gt;</strong>: white'&gt;&lt;b&gt;White&lt;/b&gt;&lt;/span&gt;</p>
  
  <p>and obviously, messing up my style is not a good idea.</p>
  
  <p>Here is the code I am using:</p>
  
  <pre><code>        Query parsedQuery = parser.Parse(luceneQuery);
          StandardAnalyzer Analyzer = new StandardAnalyzer();
          SimpleHTMLFormatter formatter = new SimpleHTMLFormatter("&lt;b class='search'&gt;", "&lt;/b&gt;");
  
          QueryScorer scorer = new QueryScorer(parsedQuery);
          Highlighter highlighter = new Highlighter(formatter, scorer);
  
          highlighter.SetTextFragmenter(new SimpleFragmenter());
          Highlighter.GetBestFragment(Analyzer, propertyName, invocation.ReturnValue.ToString())
  </code></pre>
  
  <p>I'm guessing the problem is that i need a different Fragmenter, but I'm not sure.  Any help would be appreciated.</p>