为什么lucene.net highlighter只突出显示第一个事件
我有这个密码。为什么它只突出显示第一次出现为什么lucene.net highlighter只突出显示第一个事件,lucene,lucene.net,Lucene,Lucene.net,我有这个密码。为什么它只突出显示第一次出现 public string SearchY(string htmlContent, string searchText) { ISet<String> stopWords = getUpdatedStandardAnalyserStopWords(System.Environment.CurrentDirectory + "\\stopwords.txt");
public string SearchY(string htmlContent, string searchText)
{
ISet<String> stopWords = getUpdatedStandardAnalyserStopWords(System.Environment.CurrentDirectory + "\\stopwords.txt");
try
{
using (StandardAnalyzer standardAnalyzer = new StandardAnalyzer(Version.LUCENE_30, stopWords))
{
QueryParser parser = new QueryParser(Version.LUCENE_30, "Content", standardAnalyzer);
Query query = parser.Parse(searchText);
QueryScorer scorer = new QueryScorer(query, "Content");
SimpleHTMLFormatter htmlFormatter = new SimpleHTMLFormatter("<span style=\"font-weight:bold; background-color:yellow;\">", "</span>");
Highlighter highlighter = new Highlighter(htmlFormatter, scorer);
highlighter.TextFragmenter = new NullFragmenter();
StandardTokenizer tonizer = new StandardTokenizer(Version.LUCENE_30, new IO.StringReader(searchText));
string m2 = highlighter.GetBestFragments(tonizer, htmlContent, 1000, "...");
return m2;
}
}
catch (Exception ex)
{
string exMesg = ex.Message;
return exMesg;
}
}
这就是我得到的
“abc sded abc sedff abe abc sss”
为什么它没有突出显示“abc”的其他事件
string d = SearchY("abc sded abc sedff abe abc sss","abc");