You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Endika Posadas <en...@gmail.com> on 2022/05/20 09:28:57 UTC

Solr Highlighting full phrases instead of words

Hi all,

I am using Solr's Unified highlighter to highlight parts of a text block.
However, I have noticed that the highlighter, instead of highlighting the
whole phrase, highlights the words separately.

For example, if we search for "hello world" it will highlight <b>hello</b>
<b>world</b>. Both words are highlighted, so it's barely noticeable.

On the other hand, if we phrase search for "hello world" and the text
contains 'hello to the world' (where 'to' and 'the' are stop words), it
will highlight <b>hello</b> to the <b>world</b>. This can be a bit
confusing and we would like to highlight the whole phrase instead <b>hello
to the world</b>.

Is there a way to highlight so that the whole matched phrase gets
highlighted instead of the individual words?

Thanks

Re: Solr Highlighting full phrases instead of words

Posted by Dave <ha...@gmail.com>.
Did you try mergeContiguous yet and see if it produced what you wanted?


> On May 20, 2022, at 8:19 AM, Endika Posadas <en...@gmail.com> wrote:
> 
> Hi all,
> 
> I am using Solr's Unified highlighter to highlight parts of a text block.
> However, I have noticed that the highlighter, instead of highlighting the
> whole phrase, highlights the words separately.
> 
> For example, if we search for "hello world" it will highlight <b>hello</b>
> <b>world</b>. Both words are highlighted, so it's barely noticeable.
> 
> On the other hand, if we phrase search for "hello world" and the text
> contains 'hello to the world' (where 'to' and 'the' are stop words), it
> will highlight <b>hello</b> to the <b>world</b>. This can be a bit
> confusing and we would like to highlight the whole phrase instead <b>hello
> to the world</b>.
> 
> Is there a way to highlight so that the whole matched phrase gets
> highlighted instead of the individual words?
> 
> Thanks