开发者

How to Increase/Configure Snippet size of a highlight?

开发者 https://www.devze.com 2023-01-11 08:46 出处:网络
I want to know that how we can configure Snippet Size(number of words/Characters) in highlighting? Currently i m facing a problem, sometimes solr Gives me snippet exactly the matched word. like let sa

I want to know that how we can configure Snippet Size(number of words/Characters) in highlighting? Currently i m facing a problem, sometimes solr Gives me snippet exactly the matched word. like let say I query solr as "Contents:risk" using solrnet it gives me exactly "risk" in hig开发者_高级运维hlighting snippets no more characters or words i do the same with Solr admin and it gives the same result too.


I'm not quite familiar with highlighting features but I believe this is done with the hl.fragsize parameter.


Mauricio already answered and this is a little bit of an old thread, but just to add the solution using SolrNet it would be:

  • Create a new Highlighting parameters object.

  • Set fragsize

  • Other parameters are possible

  • Highlighting documentation can be found here: Highlighting.md

Here is a sample code:

 private HighlightingParameters SetHighLightSnippetParameters()
        {
            return new HighlightingParameters
            {
                Fragsize = SearchConstants.SnippetSize
            };
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消