Solr突出问题 [英] Solr Highlighting Problem

查看:63
本文介绍了Solr突出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个问题,当我查询Solr时,它与结果匹配,但是当我在此查询的结果上启用突出显示时,突出显示不起作用.

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..

我的查询是

+目录:"item 503"

+Contents:"item 503"

内容是文本类型,文本项503中的一项重要内容显示为项503(c)",最后是否可以打开括号而产生问题?请帮助

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

这是SolrSonfig.xml中的突出显示部分

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" />

问候 阿三.

推荐答案

您是否也尝试过存储术语向量?如果您使用的是快速矢量荧光笔(我认为Solr在默认情况下可能会用到),那么您将需要这些.

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.

这篇关于Solr突出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆