【问题标题】:Solr dismax highlighting not respecting analyzerSolr dismax 突出显示不尊重分析器
【发布时间】:2014-02-18 10:50:03
【问题描述】:

Solr 3.6.2的架构中有两个field声明,textexact

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

前者使用StandardTokenizer,后者使用KeywordTokenizer

描述问题的 Solr 查询:

?hl=true
&hl.fl=text,exact
&defType=edismax
&qf=text+exact         <-------- here
&q=a-b

突出显示字段精确的输出: &lt;em&gt;a&lt;/em&gt;-&lt;em&gt;b&lt;/em&gt;。 问题是字段exact 的摘要是使用来自text 的分析器生成的。

?hl=true
&hl.fl=text,exact
&defType=edismax
&qf=exact              <-------- here
&q=a-b

突出显示字段精确的输出: &lt;em&gt;a-b&lt;/em&gt;。 通过简单地从qf 中删除text,我们得到了正确的分析器,为什么?

【问题讨论】:

    标签: java solr search-engine edismax dismax


    【解决方案1】:

    debugQuery 开启

    +DisjunctionMaxQuery(((exact:a-b) | ((text:a text:b)~2)))
    

    exact 中找到匹配项后的 Solr 荧光笔似乎也仅根据查询中的存在匹配 abhl.requireFieldMatch=true 似乎确实可以解决这个问题!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-30
      • 2013-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-19
      相关资源
      最近更新 更多