tags:

views:

51

answers:

1

Hi All I have a problem that when i Query Solr it matches results, but when i enable highlighting on the results of this query the highlighting does not work..

My Query is

+Contents:"item 503"

Contents is of type text and one important thing in text item 503 appear as "item 503(c)", can open parenthesis at the end create problem?? please help

here is highlighting section in SolrSonfig.xml

  <highlighting>
   <!-- Configure the standard fragmenter -->
   <!-- This could most likely be commented out in the "default" case -->
   <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">
    <lst name="defaults">
     <int name="hl.fragsize">100</int>
    </lst>
   </fragmenter>

   <!-- A regular-expression-based fragmenter (f.i., for sentence extraction) -->
   <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
    <lst name="defaults">
      <!-- slightly smaller fragsizes work better because of slop -->
      <int name="hl.fragsize">70</int>
      <!-- allow 50% slop on fragment sizes -->
      <float name="hl.regex.slop">0.5</float>
      <!-- a basic sentence pattern -->
      <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
    </lst>
   </fragmenter>

   <!-- Configure the standard formatter -->
   <formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">
    <lst name="defaults">
     <str name="hl.simple.pre"><![CDATA[<em>]]></str>
     <str name="hl.simple.post"><![CDATA[</em>]]></str>
    </lst>
   </formatter>
  </highlighting>

and here is fieldtype definition in schema.xml

  <fieldtype name="text" class="solr.TextField">
    <analyzer>
      <tokenizer class="solr.StandardTokenizerFactory" luceneMatchVersion="LUCENE_29"/>
      <filter class="solr.StandardFilterFactory"/>
     <!-- <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.StopFilterFactory" luceneMatchVersion="LUCENE_29"/>
      <filter class="solr.EnglishPorterFilterFactory"/>-->
    </analyzer>
  </fieldtype>

and here is field definition

<field name="Contents" type="text" indexed="true" stored="true" />

Regards Ahsan.

+1  A: 

Have you tried storing the term vectors too? If you're using the fast vector highlighter (which I think Solr might by default) you'll need those.

Xodarap
One thing highlighting does not fail always it works most of the time, but in above mentioned case it had searched the term but doesn't highlight it, Secondly i have stored term vectors but as i know Fast Vector Highlighter will be available with Solr 1.5,
Ahsan Iqbal
Have you tried playing with the params?1. Set slop to be really big2. set regex to match .*A possibility here is that your field is just the phrase "item 501(c)" and so the minimum length on your regex (20) isn't getting satisfied.
Xodarap
thanx very much its done..
Ahsan Iqbal