Get starting and end index of a highlighted fragment in a searched field

Posted by Umer on Stack Overflow See other posts from Stack Overflow or by Umer
Published on 2010-05-13T06:29:40Z Indexed on 2010/05/13 7:34 UTC
Read the original article Hit count: 247

Filed under:

"My search returns a highlighted fragment from a field. I want to know that in that field of particular searched document, where does that fragment starts and ends ?"

for instance.

consider i am searching "highlighted fragment" in above lines (consider the above para as single document).

I am setting my fragmenter as :

SimpleFragmenter fragmenter = 
            new SimpleFragmenter(30);

now the output of GetBestFragment is somewhat like : "returns a highlighted fragment from"

Is it possible to get the starting and ending index of this fragment in the text above (say starting is 10 and ending is 45)

© Stack Overflow or respective owner

Related posts about lucene.net