user2551549
user2551549

Reputation: 192

unable to give hl.fragmenter as regex in solrconfig

I am trying to make requestHandler which also gives me highlighted result, but if I search for /Highlight it gives me error as "Unknown fragmenter: regex (error code - 400)"

My configuration in solrConfig.xml:

<requestHandler name="/highlight" class="solr.SearchHandler" default="true">
<lst name="defaults">
   <str name="echoParams">explicit</str>
   <str name="defType">edismax</str>
   <str name="q.alt">*:*</str>
   <str name="rows">10</str>
   <str name="fl">*,score</str>
   <str name="qf">
      id^0.5 name^1.0 description^1.2 
   </str>
   <str name="hl">on</str>
   <str name ="hl.snippets">5</str>
   <str name="hl.fragsize">50</str>
   <str name="hl.maxAnalyzedChars">510000</str>
   <str name="hl.requireFieldMatch">true</str>
   <str name="hl.fragmenter">regex</str>
   <str name ="hl.fragListBuilder">simple</str>
   <str name="hl.phraseLimit">1000</str>
   <str name="hl.usePhraseHighlighter">true</str>
   <str name="hl.highlightMultiTerm">true</str>
   <str name ="hl.useFastVectorHighligher">true</str>
 </lst>
</requestHandler>

If I remove <str name="hl.fragmenter">regex</str> line, search is working fine, but the highlighted result only come in the end of string even there is more text after the search key. for example if i search for "Deployment Manager" it will return result as:

<lst name="DEX1201">
    <arr name="name">
      <str>Are these the same product? Red Gate <em>Deployment Manager</em></str>
    </arr>
  </lst>
  <lst name="DEE2112">
    <arr name="name">
      <str>no of group, or cell, of other servers. The <em>Deployment Manager</em></str>
    </arr>
  </lst>

Expected Resut:

<lst name="DEX1201">
    <arr name="name">
      <str>...same product? Red Gate <em>Deployment Manager</em> is the one of the.../str>
    </arr>
 </lst>

Thanks in advance :)

Upvotes: 0

Views: 642

Answers (1)

leoh
leoh

Reputation: 10618

Please verify or add a regex fragmenter in the solrconfig.xml

This is an example taken from the solr-4.6.1 example config.

  <!-- A regular-expression-based fragmenter (for sentence extraction) -->
  <fragmenter name="regex" class="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\&quot;&apos;]{20,200}</str>
    </lst>
  </fragmenter>

It should be defined within the

<searchComponent class="solr.HighlightComponent" name="highlight">

HighlightComponent example

Upvotes: 1

Related Questions