I'm using PostingsSolrHighlighter, with default params, and it seems to be giving good results. My use case is to search text paragraphs against the full doc and get relevant snippets, and this highlighter does give most close paragraphs from matching documents.
The customization i need is to remove waste snippets which do not seem related to the searched para. At this time, i'm looking to employ a simple method: remove the snippets that have a relative score of 0.5 or less. But i can't find a way to get the scores Solr computes for the sentences/snippets, so i can discard the less desired ones.
Can i tell solr to keep snippets only when its score is greater than xyz score, or it can give me the snippets score somehow?
I still want to keep the order (according to the start-position of snippets in the original doc) of resultant snippets.
Thanks.
Ok, i could not get any way to ask Solr to return snippets with scores or discard snippets having score less than certain number, but i extended the highlighter and formatter, and now getting snippet with their scores (solr-computed absolute score & relative score). Below is the extension code if needed by someone:
and with this extended code, i'm getting snippets and their scores in search results, as follows:
Number in [ ] indicates score of a single statement, number in [[ ]] indicates avg score (sum of all sentences' scores / sentence count in snippet) of the whole snippet (a snippet may contain multiple sentences), and number in {{ }} indicates snippet's relative score (against other snippet's avg scores).