You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by ao...@swissonline.ch on 2014/04/11 12:16:24 UTC

highlighting displays to much

i am using solr 4.3.1 and want to highlight complete sentences if possible or at least not cut up words. it it finds something the hole field is displayed instead of only 180 chars

the field is:
<fieldType name="text_de" class="solr.TextField" positionIncrementGap="100">
<field name="plain_text" type="text_de" indexed="true" stored="true" default="" />	

solrconfig setting for highlighting:
       <str name="hl">true</str>
       <str name="hl.fl">plain_text title description</str>
       <str name="hl.simple.pre">&lt;b&gt;</str>
       <str name="hl.simple.post">&lt;/b&gt;</str>
       <str name="hl.snippets">5</str>
	   <str name="hl.fragsize">180</str>
	   <str name="hl.fragmenter">regex</str>
	   <str name="hl.regex.slop">0.2</str>
	   <str name="hl.regex.pattern">\w[^\.!\?]{20,160}</str>

Re: highlighting displays to much

Posted by Furkan KAMACI <fu...@gmail.com>.
Hi;

Firstly it is not usual that highlighter cuts up words. When you change the
slop size you will realize that highlight size may change. Slop size is how
far the fragmenter can stray from the ideal fragment size. A slop of 0.2
means that the fragmenter can go over or under by 20%.

Thanks;
Furkan KAMACI


2014-04-11 13:16 GMT+03:00 <ao...@swissonline.ch>:

> i am using solr 4.3.1 and want to highlight complete sentences if possible
> or at least not cut up words. it it finds something the hole field is
> displayed instead of only 180 chars
>
> the field is:
> <fieldType name="text_de" class="solr.TextField"
> positionIncrementGap="100">
> <field name="plain_text" type="text_de" indexed="true" stored="true"
> default="" />
>
> solrconfig setting for highlighting:
>        <str name="hl">true</str>
>        <str name="hl.fl">plain_text title description</str>
>        <str name="hl.simple.pre">&lt;b&gt;</str>
>        <str name="hl.simple.post">&lt;/b&gt;</str>
>        <str name="hl.snippets">5</str>
>            <str name="hl.fragsize">180</str>
>            <str name="hl.fragmenter">regex</str>
>            <str name="hl.regex.slop">0.2</str>
>            <str name="hl.regex.pattern">\w[^\.!\?]{20,160}</str>
>