首页 > 解决方案 > Solr 7.4.0 将所有带有 copyfield 的字段搜索到默认字段中不起作用

问题描述

我查看了许多类似的问题。答案是将所有字段复制到一个字段并将其设置为默认字段。但是,它仍然无法正常工作。

我的一些领域:

  <field name="Unit" type="string" docValues="true" indexed="true" stored="true"/>
  <field name="Amount" type="pdoubles" docValues="true" indexed="true" stored="true"/>
  <field name="Comment" type="text_general" docValues="true" indexed="true" stored="true"/>

我加:

<field name="searchall" type="text_general" multiValued="true" indexed="true" stored="true"/>

(我也尝试了 stored="false" 但它们都不起作用)并通过模式 API 在托管模式下添加我需要的所有复制字段。

然后我变了

<initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse">
  <lst name="defaults">
    <str name="df">searchall</str>
  </lst>
</initParams>

在 solrconfig.xml 中

当我搜索 q=something 时,它仍然没有给出任何信息。有谁知道我哪里做错了?

标签: solr

解决方案


正如 MatsLindh在评论中提到的,不要忘记重新索引。

添加您的复制字段 - 如果您明确引用该字段而不是使用它是否有效df?更改配置后是否重新索引?如果您在添加 copyField 指令后没有重新索引,那么目标字段中将没有任何内容。复制操作发生在文档被索引时。

我重新导入数据并且它有效。


推荐阅读