flexsearch icon indicating copy to clipboard operation
flexsearch copied to clipboard

How to return context (+ or - few lines) around the hits of given search text

Open anandncode opened this issue 2 years ago • 0 comments

Hi,

I am looking for this particular feature.

  1. Suppose I have text of 100 lines.
  2. I have created the index and added this text
  3. I am searching for 2 words.
  4. These words are found at lines 20, 50 (lets call them as hits)
  5. In the result set I am looking for text around the hits
    • That is something like 15 to 25 lines, 45 to 55 lines

It may not be exactly lines, but it can be few characters/words around the hits. I tried creating contextual index & enrich result set. But none seems to be working. In the results I see the whole 100 lines of text instead of specific hits.

Any help would be highly appreciated

anandncode avatar Feb 29 '24 13:02 anandncode