Highlighter 2.0 加亮 Lucene

First we need to create a Highlighter instance;

Highlighter 2.0 加亮 Lucene  Highlighter hl  =   new  Highlighter( new  SimpleHTMLFormatter( " <font color=\ " red\ "  font-size=\ " 14px\ " > " , " </font> " ), new  QueryScorer(query));

Use GetBestFragment method get the result
Highlighter 2.0 加亮 Lucene  row[ " Name " =   hl.GetBestFragment(sa, " Name " ,doc.Get( " Name " ));
Highlighter 2.0 加亮 Lucene   row[
" Introduce " =  hl.GetBestFragment(sa, " Introduce " ,doc.Get( " Introduce " ));

row this is a table row

你可能感兴趣的:(highlighter)