Solr Facet搜索 - 拼写检查

时间:2013-05-10 12:34:09

标签: solr

我在一列数据库中使用Solr facet搜索。它成功返回数据:

<lst name="facet_counts">
  <lst name="facet_queries"/>
  <lst name="facet_fields">
    <lst name="tags">
      <int name="lol">58</int>
      <int name="scienc">58</int>
      <int name="photo">34</int>
      <int name="axiom">27</int>
      <int name="geniu">14</int>
   </lst>
  </lst>
  <lst name="facet_dates"/>
  <lst name="facet_ranges"/>
</lst>

我想确保只计算完整的单词。在上面的例子中,你可以看到'cienc'和'geniu'的计数应该是'科学'和'天才'。我怎样才能做到这一点?我可以加入拼写检查功能吗?

2 个答案:

答案 0 :(得分:0)

这可能与您与标记字段关联的基础fieldType有关。字段值最有可能被阻止或者与其相关联的其他分析器。我建议两件事之一:

  1. 删除词干和/或其他处理,以防止词语显示为部分。
  2. (推荐)在schema.xml中使用tags_facet创建单独的字段fieldType="string",并使用copyField指令将值Feed复制到原始tags字段中。然后在这个新的tags_face字段上进行分析。

答案 1 :(得分:0)

使用Solr的copyField功能将原始字段复制到字符串fieldType的字段。如果值是一组单词而不是字符串,则可以使用空格标记字段类型(当然不包含ngram。)

相关问题