0

I am using solr and need to get the highlighting results in separated snippets by newlines. For example, searching "scores" using this text:

Algebra:
My scores are:
A, A+, B, B, A

Calculus:
My scores are:
B, A, A, A+, B

I want to get in one snippet:

Algebra:
My <em>scores</em> are:
A, A+, B, B, A

And in another snippet:

Calculus:
My <em>scores</em> are:
B, A, A, A+, B

The full result use 2 newlines (\n \n) as splitter, so I tried using hl.fragmenter=regex&hl.regex.pattern=[%0A%20%0A] to separate them. However the snippets are not being splitted by this pattern.

I would like to split text in snippets regardless the size of the text between the 2 newlines.

1 Answers1

0

It could be that in addition to the newline there is a carriage return as well, see: Difference between \n and \r?.

You can try using this regex that will take that into account:

/\r?\n\r?\n/
Community
  • 1
  • 1
Shaido
  • 27,497
  • 23
  • 70
  • 73