# Is it possible to highlight the text with respect to no. of lines instead of no. of fragments

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-highlight-the-text-with-respect-to-no-of-lines-instead-of-no-of-fragments/17429>\
**Category:** Elasticsearch\
**Created:** [May 9, 2014, 12:29pm UTC](https://discuss.elastic.co/t/is-it-possible-to-highlight-the-text-with-respect-to-no-of-lines-instead-of-no-of-fragments/17429 "2014-05-09T12:29:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand\_kumar](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Anand\_kumar](https://discuss.elastic.co/u/Anand_kumar)\
**Post date:** [May 9, 2014, 12:29pm UTC](https://discuss.elastic.co/t/is-it-possible-to-highlight-the-text-with-respect-to-no-of-lines-instead-of-no-of-fragments/17429/1 "2014-05-09T12:29:06Z")

</div>

Am having an index of huge content, from which I just want to have the  
highlighting of the specific text.

The highlighted text might have appear as many as times, all I want to have  
two or more lines before and after the line of highlighted text, by which i  
can have a snippet of text with highlighted parts are in the middle of the  
snippet, so that they can be easily located and identified from a huge  
content of file.

Is it possible?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/04094295-1848-4fef-a210-255d135f365e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/04094295-1848-4fef-a210-255d135f365e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 9, 2014, 2:55pm UTC](https://discuss.elastic.co/t/is-it-possible-to-highlight-the-text-with-respect-to-no-of-lines-instead-of-no-of-fragments/17429/2 "2014-05-09T14:55:55Z")

</div>

On Fri, May 9, 2014 at 8:29 AM, Anand kumar [anandv1000@gmail.com](mailto:anandv1000@gmail.com) wrote:

> Am having an index of huge content, from which I just want to have the  
> highlighting of the specific text.
> 
> The highlighted text might have appear as many as times, all I want to  
> have two or more lines before and after the line of highlighted text, by  
> which i can have a snippet of text with highlighted parts are in the middle  
> of the snippet, so that they can be easily located and identified from a  
> huge content of file.
> 
> Is it possible?

The only segmentation options are based on characters, sentences, and  
grabbing the contents of the whole field. The trick with lines is, unless  
the text contains explicit new lines and you only wrap on new lines, then  
you have to estimate line breaks based on the rendering context. Stuff  
like width in pixels and the font. If you want to be precise you need the  
screen dpi as well and a font rendering engine that works similarly. Some  
contexts don't properly render ligatures, some do. And its 1000x worse  
when you leave English and go to something like Arabic or Sanskrit. There  
be dragons.

But, if you are talking about code, or something else with explicit  
newlines and that only wraps on newlines, then the answer is still no, but  
it wouldn't be hard to implement.

Nik

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1p3TQB1Db%3DKP0S1n2maYJMb7zPOXLdBKHkyZH0gZVQCQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1p3TQB1Db%3DKP0S1n2maYJMb7zPOXLdBKHkyZH0gZVQCQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Anand\_kumar](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Anand\_kumar](https://discuss.elastic.co/u/Anand_kumar)\
**Post date:** [May 12, 2014, 10:39am UTC](https://discuss.elastic.co/t/is-it-possible-to-highlight-the-text-with-respect-to-no-of-lines-instead-of-no-of-fragments/17429/3 "2014-05-12T10:39:20Z")

</div>

Thank u Nik for your reply.

On Friday, 9 May 2014 20:25:55 UTC+5:30, Nikolas Everett wrote:

> On Fri, May 9, 2014 at 8:29 AM, Anand kumar \<[anand...@gmail.com](mailto:anand...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Am having an index of huge content, from which I just want to have the  
> > highlighting of the specific text.
> > 
> > The highlighted text might have appear as many as times, all I want to  
> > have two or more lines before and after the line of highlighted text, by  
> > which i can have a snippet of text with highlighted parts are in the middle  
> > of the snippet, so that they can be easily located and identified from a  
> > huge content of file.
> > 
> > Is it possible?
> 
> The only segmentation options are based on characters, sentences, and  
> grabbing the contents of the whole field. The trick with lines is, unless  
> the text contains explicit new lines and you only wrap on new lines, then  
> you have to estimate line breaks based on the rendering context. Stuff  
> like width in pixels and the font. If you want to be precise you need the  
> screen dpi as well and a font rendering engine that works similarly. Some  
> contexts don't properly render ligatures, some do. And its 1000x worse  
> when you leave English and go to something like Arabic or Sanskrit. There  
> be dragons.
> 
> But, if you are talking about code, or something else with explicit  
> newlines and that only wraps on newlines, then the answer is still no, but  
> it wouldn't be hard to implement.
> 
> Nik

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/892cbfdf-5783-4a0b-a06c-328c0e3f2b72%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/892cbfdf-5783-4a0b-a06c-328c0e3f2b72%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:30am UTC](https://discuss.elastic.co/t/is-it-possible-to-highlight-the-text-with-respect-to-no-of-lines-instead-of-no-of-fragments/17429/4 "2017-07-06T01:30:11Z")

</div>


