OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to Extract the First Matching Highlighted Snippet and Surrounding Sentences from Solr

  • Thread starter Thread starter Przemek
  • Start date Start date
P

Przemek

Guest
I'm working with Solr and need to extract the first sentence that matches the query along with its highlighted snippet and surrounding sentences. How can I achieve this using Solr?

Lets take this whole highlighted input:

Code:
Some sentence. First sentence before highlighting. Sentence with <em>HighlightedTerm</em>. Sentence after the highlighting. Some sentence. Another Sentence with <em>HighlightedTerm</em>

Expected output:

Code:
First sentence before highlighting. Sentence with <em>HighlightedTerm</em>. Sentence after the highlighting.

The only idea I had was to get the whole text with highlits from solr and tokenize the text by sentences and choose what I need. But I am wondering if solr API supports this what I need to some extent.
<p>I'm working with Solr and need to extract the first sentence that matches the query along with its highlighted snippet and <strong>surrounding sentences</strong>. How can I achieve this using Solr?</p>
<p>Lets take this whole highlighted input:</p>
<pre><code>Some sentence. First sentence before highlighting. Sentence with <em>HighlightedTerm</em>. Sentence after the highlighting. Some sentence. Another Sentence with <em>HighlightedTerm</em>
</code></pre>
<p>Expected output:</p>
<pre><code>First sentence before highlighting. Sentence with <em>HighlightedTerm</em>. Sentence after the highlighting.
</code></pre>
<p>The only idea I had was to get the whole text with highlits from solr and tokenize the text by sentences and choose what I need. But I am wondering if solr API supports this what I need to some extent.</p>
 

Latest posts

M
Replies
0
Views
1
MOHAMED AMIIN ABDI AADAN
M
Top