VaniSaran
VaniSaran

Reputation: 11

How to Highlight long text fields in solr 4.0?

I have field named “Fulltext” in solr which has more than 50,000 characters. I want to highlight the search keyword for that field. I have set

 f.Fulltext.hl.snippets=30
    f.Fulltext.hl.fragsize =50000
    h1.MaxAnalyzedChars = 100000;

The problem I am facing is, the whole document in “Fulltext” field is either not getting highlighted or fully produced. It’s producing only partial document. For all other fields highlighting is working good. I think since this field has too many characters it is not working? Can anyone help me to solve this issue?

Thanks in advance

Upvotes: 1

Views: 2122

Answers (2)

Paige Cook
Paige Cook

Reputation: 22555

Your setting of f.Fulltext.hl.fragsize=50000 is limiting the size of the highlighting snippet to only 50,000 characters and you have stated that your field is longer than 50,000 characters. In order to get the results that you are looking for, you should set f.Fulltext.hl.fragsize=0 (indicating unlimited) along with your hl.maxAnalyzedChars=100000. See the hl.maxAnalyzedChars reference on the Solr Wiki.

Please note that the above will work only with the original Highlighter. If you are using the FastVectorHighlighter, you should see the notes for hl.fragSize reference on the Solr wiki.

Upvotes: 4

cupiqi09
cupiqi09

Reputation: 338

The parameters are case-sensitive.

h1.MaxAnalyzedChars //won't work

hl.maxAnalyzedChars //will (also there was a typo: hl instead of h1...)

Setting

hl.maxAnalyzedChars=-1

will indicate unlimited.

Upvotes: 1

Related Questions