lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shamik Bandopadhyay <sham...@gmail.com>
Subject Highlighting simple.pre and simple.post values getting ignored
Date Mon, 10 Nov 2014 23:17:42 GMT
Hi,

  I'm facing a weird issue where the specified "hl.simple.pre" and
"hl.simple.post" values for highlighting is getting ignored. In my test
handler, I've the following entry:

<!-- Highlighting defaults -->
<str name="hl">true</str>
<str name="hl.simple.pre"><![CDATA[<span class="vivbold qt0">]]></str>
<str name="hl.simple.post"><![CDATA[</span>]]></str>
<str name="hl.fl">name subject</str>
<str name="hl.encoder">html</str>
<str name="f.subject.hl.fragsize">200</str>
<str name="hl.usePhraseHighlighter">false</str>
<str name="hl.useFastVectorHighlighter">true</str>
<str name="hl.boundaryScanner">breakIterator</str>


 <searchComponent class="solr.HighlightComponent" name="highlight">
    <highlighting>
      <fragmenter name="gap"
                  default="true"
                  class="solr.highlight.GapFragmenter">
        <lst name="defaults">
          <int name="hl.fragsize">100</int>
        </lst>
      </fragmenter>

      <fragmenter name="regex"
                  class="solr.highlight.RegexFragmenter">
        <lst name="defaults">
          <int name="hl.fragsize">70</int>
          <float name="hl.regex.slop">0.5</float>
          <str name="hl.regex.pattern">[-\w ,/\n\&quot;&apos;]{20,200}</str>
        </lst>
      </fragmenter>

      <formatter name="html"
                 default="true"
                 class="solr.highlight.HtmlFormatter">
        <lst name="defaults">
          <str name="hl.simple.pre"><![CDATA[<span class="vivbold
qt0">]]></str>
          <str name="hl.simple.post"><![CDATA[</span>]]></str>
        </lst>
      </formatter>

      <encoder name="html"
               class="solr.highlight.HtmlEncoder" />

      <fragListBuilder name="simple"
                       class="solr.highlight.SimpleFragListBuilder"/>

      <fragListBuilder name="single"
                       class="solr.highlight.SingleFragListBuilder"/>

      <fragListBuilder name="weighted"
                       default="true"
                       class="solr.highlight.WeightedFragListBuilder"/>

      <!-- default tag FragmentsBuilder -->
      <fragmentsBuilder name="default"
                        default="true"
                        class="solr.highlight.ScoreOrderFragmentsBuilder">
      </fragmentsBuilder>

      <!-- multi-colored tag FragmentsBuilder -->
      <fragmentsBuilder name="colored"
                        class="solr.highlight.ScoreOrderFragmentsBuilder">
        <lst name="defaults">
          <str name="hl.tag.pre"><![CDATA[
               <b style="background:yellow">,<b
style="background:lawgreen">,
               <b style="background:aquamarine">,<b
style="background:magenta">,
               <b style="background:palegreen">,<b
style="background:coral">,
               <b style="background:wheat">,<b style="background:khaki">,
               <b style="background:lime">,<b
style="background:deepskyblue">]]></str>
          <str name="hl.tag.post"><![CDATA[</b>]]></str>
        </lst>
      </fragmentsBuilder>

      <boundaryScanner name="default"
                       default="false"
                       class="solr.highlight.SimpleBoundaryScanner">
        <lst name="defaults">
          <str name="hl.bs.maxScan">10</str>
          <str name="hl.bs.chars">.,!? &#9;&#10;&#13;</str>
        </lst>
      </boundaryScanner>

      <boundaryScanner name="breakIterator"
                       class="solr.highlight.BreakIteratorBoundaryScanner">
        <lst name="defaults">
          <!-- type should be one of CHARACTER, WORD(default), LINE and
SENTENCE -->
          <str name="hl.bs.type">SENTENCE</str>
          <!-- language and country are used when constructing Locale
object.  -->
          <!-- And the Locale object will be used when getting instance of
BreakIterator -->
          <str name="hl.bs.language">en</str>
          <str name="hl.bs.country">US</str>
        </lst>
      </boundaryScanner>
    </highlighting>
  </searchComponent>

As you can see, I've specified the simple.pre and simple.post values in the
request handler as well as under standard formatter.

But, search result is always wrapping the term with <em></em>, not sure
where is this value coming from. There's no reference of it in solrconfig
file. Looks like it's ignoring the value from solrconfig and defaulting it
to <em>.

Can someone provide any pointer ? I'm using Solr 4.7.

Thanks,
Shamik

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message