Get the start and end index of the selected fragment in the desired field

"My search returns the selected fragment from the field. I want to know that in this field of the specific search document, where does this fragment begin and end?"

eg.

I believe that I am viewing the “highlighted fragment” in the above lines (we will consider the above paragraph as a single document).

I set my fragmentator as:

SimpleFragmenter fragmenter = 
            new SimpleFragmenter(30);

Now the output of GetBestFragment is somewhat reminiscent of: "returns the selected fragment from"

Is it possible to get the starting and ending index of this fragment in the text above (for example, the beginning is 10 and ends at 45)

+3
2

getBestFragment. Highlighter TokenGroup . , .

+1

. Formatter Encoder. , , formatter , , . , , - . TokenGroup . .

0

Source: https://habr.com/ru/post/1745229/


All Articles