1

In Highlighter.Net, we can use NullFragmenter to return the entire field content. Is there any way we can do this in FastVectorHighlighter.Net?

Midhat
  • 17,454
  • 22
  • 87
  • 114

3 Answers3

2

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])

vladimir
  • 13,428
  • 2
  • 44
  • 70
  • I would set SimpleFragListBuilder.MIN_FRAG_CHAR_SIZE = 0 just to not have to worry about it. And sending fragCharSize: desiredMaximumLength. – Valentin Jul 08 '15 at 15:36
0

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?

buru
  • 3,190
  • 25
  • 35
  • You may wrap this content with your formatter html (I know, it's conceptually ugly, but sometimes such things are inevitable). – buru Jul 13 '10 at 09:54
  • The problem would be where to insert the formatter html. thats the whole point of using the highlighter – Midhat Jul 26 '10 at 06:13
0

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

Eran
  • 387,369
  • 54
  • 702
  • 768
Midhat
  • 17,454
  • 22
  • 87
  • 114