如何使用Lucene.Net Highlight功能实现此功能?

时间:2011-12-20 07:50:38

标签: lucene lucene.net

我使用Lucene.Net 2.9.2。我想使用突出显示功能来实现此功能:

highlighter.Keyword = "wiping citroen berlingo";
highlighter.StartTag = "<span>";
highlighter.EndTag = "</span>";

var text = "The Citroen Berlingo has two windscreen wipers at the front and one wiper at the back.  They're great for wiping stuff away.";

我想要这个结果:

"The <span>Citroen</span> <span>Berlingo</span> has two windscreen <span>wipers</span> at the front and one <span>wiper</span> at the back.  They're great for <span>wiping</span> stuff away."

但我得到了这个:

"The <span>Citroen</span> <span>Berlingo</span> has two windscreen wipers at the front and one wiper at the back.  They're great for **<span>wiping</span>** stuff away."

可能导致这种差异的原因是什么?

1 个答案:

答案 0 :(得分:0)

你可能没有阻止你的输入。例如,尝试使用Porter stemmer。