i use this simple code to highlight match words in string :
var query = "محمد";
var snowballAnalyzer = new ArabicAnalyzer(Lucene.Net.Util.Version.LUCENE_30, "Arabic");
var input = new QueryParser(Lucene.Net.Util.Version.LUCENE_30, "",snowballAnalyzer).Parse(query);
var text = "محمٌد محمُد محمَد اسعد محمود";
var steam = TokenSources.GetTokenStream("default",text,snowballAnalyzer);
var hit = new Highlighter(new SimpleHTMLFormatter(),new QueryScorer(input));
TextFragment[] frag = hit.GetBestTextFragments(steam ,text,false,4);
String textt = hit.GetBestFragment(snowballAnalyzer , "", Text);
Debug.WriteLine(textt);
for(int j = 0; j<frag.Length; j++){
if((frag[j]!=null)){
Debug.WriteLine(frag[j]);
}
}
and works good so if i search for "محمد" : it will find all match and print the whole text :
<B>محمٌد</B> <B>محمُد</B> <B>محمَد</B> اسعد محمود
what i want to extract only the matches keyword from text to use it in Webbrowser controller i mean i only want the matches Highlighted keywords not the whole text how can i do that ..
i need the keywords so i can use javscript Highlighter script and use it in webbrowser controller to Highlight matches keywords in html page but if i can use lucene.net Highlighter directly without the need of js Highlighter script it would be great ..