开发者

Return Entire field from GetBestFragment in FastVectorHighlighter

In Highlighter.Net, we can use NullFragmenter to return the entire field content. 开发者_运维知识库Is there any way we can do this in FastVectorHighlighter.Net?


If you use SimpleFragListBuilder-fragmenter for FastVectorHighlighter then need to modify a public static properties of fragmenter to manage fragment size:

var fieldContent = "some data";

SimpleFragListBuilder.MARGIN = fieldContent.Length;
SimpleFragListBuilder.MIN_FRAG_CHAR_SIZE = SimpleFragListBuilder.MARGIN*3;

var result = highlighter.GetBestFragment(.., fragCharSize: SimpleFragListBuilder.MIN_FRAG_CHAR_SIZE);

(see source for details - 'Lucene.Net 3.0.3 SimpleFragListBuilder.cs' [http://lucenenet.apache.org/docs/3.0.3/dd/d38/_simple_frag_list_builder_8cs_source.html])


Isn't it an option to just use document.Get("field_name") and return the entire field content in such a way? You probably have you document somewhere in the context anyway (as you need doc id to GetBestFragment()), so why not just use it?


There is a patch for java FVH that claims to do this. I haven't personally tested it.

https://issues.apache.org/jira/browse/LUCENE-2464

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜