solr 结果分组错误意外的 docvalues 类型为字段“recentjobtitlecopy”排序集预期 = 排序

问题描述

我是 solr 的新手,想实现文档分组。我使用的是 solr 6.1 版本。我有一个包含如下字段的 schema.xml:

<field indexed="true" name="recentjobtitle" omitnorms="false" omitTermFreqAndPositions="false" stored="true" termOffsets="true" termPositions="true" termVectors="true" type="text_general"/>
<field docValues="false" indexed="true" name="recentjobtitlecopy" omitnorms="false" omitTermFreqAndPositions="false" stored="false" termOffsets="true" termPositions="true" termVectors="true" type="string_ci"/> 

这里,“recentjobtitle”是一个标记化的字段,因此为了获得分组结果,我使用了“recentjobtitlecopy”字段。

<copyField dest="recentjobtitlecopy" source="recentjobtitle"/>

现在,当我像这样运行组查询时:

group=true&group.field=recentjobtitlecopy&group.limit=10

我收到了这个异常:solr 结果分组错误意外的文档值类型为字段“recentjobtitlecopy”排序集(expected=SORTED)。

我什至尝试删除“recentjobtitlecopy”字段上的“docValues”属性,通过数据导入处理程序控制台执行重新索引。不过,例外是一样的。

奇怪的是,相同的代码适用于我的本地机器(有和没有 docValues)solr 设置,但在托管环境(这里有多个分片)上抛出异常。谁能指出我是否遗漏了什么或做错了什么?

解决方法

使用 string 作为名为 recentjobtitlecopy 的字段的 fieldType

不要在您的字段中使用多值。

您的字段定义如下所示。这是您的领域的简单定义。您可以根据需要添加其他属性。

<field name="recentjobtitlecopy" type="string" indexed="true" docValues="false" omitNorms="false" stored="false"/>