[TYPO3-Solr] Highlight snippets, fragmentsize and merged snippets

Jigal van Hemert jigal at xs4all.nl
Thu Jun 14 10:37:26 CEST 2012


Hi,

In the solr results a strange effect was observed: sometimes the search 
word was not highlighted in the results. In these cases the displayed 
snippet started at the beginning of the document and the search word was 
outside the fragment size and cropped size.

For example:
resultsHighlighting.highlightFields = title,content
resultsHighlighting.fragmentSize = 160
in template:
###CROP:###RESULT_DOCUMENT.CONTENT###|160|...|1###

I noticed that in solrconfig.xml the following is configured:
<str name="hl.fl">title,content</str>
<int name="hl.snippets">3</int>
<str name="hl.mergeContiguous">true</str>
<str name="hl.requireFieldMatch">true</str>

In one of the affected results the search terms appear twice in the 
text, pretty close together (7 words between them) and further than 160 
characters from the beginning.

It almost seems that solr decides to merge the two snippets into a big 
320 character snippet and that at least one of the terms appears within 
the first 320 characters of the content. It thus returns a combined 
snippet which is then cropped in the viewhelper and the highlighted 
search term is not shown any more.

Is this assumption correct? How can we solve it? Any other ideas?

-- 
Kind regards / Met vriendelijke groet,

Jigal van Hemert.


More information about the TYPO3-project-solr mailing list