搜索结果中包含的 pdate 字段的 SOLR 索引
SOLR index on pdate field included in search results
我正在从 SOLR 4.10.2 迁移到 8.1.1。出于某种原因,在 8.1.1 核心中,一个名为 IDX_ExpirationDate 的更新索引作为一个字段出现在搜索结果文档中。
我还有其他几个已定义但(正确地)未出现在结果中的索引。但是我遇到麻烦的索引是唯一基于更新的索引。
以下是演示该问题的示例 8.1.1 响应:
"response":{"numFound":58871,"start":0,"docs":[
{
"id":"11111",
"ExpirationDate":"2018-01-26T00:00:00Z",
"_version_":1641033044033798170,
"IDX_ExpirationDate":["2018-01-26T00:00:00Z"]},
{
"id":"22222",
"ExpirationDate":"2018-02-20T00:00:00Z",
"_version_":1641032965380112384,
"IDX_ExpirationDate":["2018-02-20T00:00:00Z"]},
ExpirationDate 应该在那里,但 IDX_ExpirationDate 不应该。我知道我可能会继续使用日期,但它已被弃用,升级到 8.1.1 的部分原因是使用最新的未弃用的东西 ;-)
我有一个名为 IDX_ExpirationDate 的索引,该索引基于名为 ExpirationDate 的字段,该字段是 4.10.2 中的日期字段:
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
<field name="IDX_ExpirationDate" type="date" indexed="true" stored="false" multiValued="true" />
<field name="ExpirationDate" type = "date" indexed = "true" stored = "true" />
<copyField source="ExpirationDate" dest="IDX_ExpirationDate"/>
在 8.1.1 内核中,我将其配置为更新:
<fieldType name="pdate" class="solr.DatePointField" docValues="true"/>
<field name="IDX_ExpirationDate" type="pdate" indexed="true" stored="false" multiValued="true" />
<field name="ExpirationDate" type = "pdate" indexed = "true" stored = "true" />
<copyField source="ExpirationDate" dest="IDX_ExpirationDate"/>
已修复。
根据 solruser 邮件列表上的 Shawn Heisey 的说法,pdate 类型默认为 docValues=true 和 useDocValuesAsStored="true",这使得它出现在结果中。
所以我通过添加 useDocValuesAsStored="false" 更改了 IDX_ExpirationDate,重新加载了索引,它不再出现在结果中:
<field name="IDX_ExpirationDate" type="pdate" indexed="true" stored="false" multiValued="true" useDocValuesAsStored="false"/>
我正在从 SOLR 4.10.2 迁移到 8.1.1。出于某种原因,在 8.1.1 核心中,一个名为 IDX_ExpirationDate 的更新索引作为一个字段出现在搜索结果文档中。
我还有其他几个已定义但(正确地)未出现在结果中的索引。但是我遇到麻烦的索引是唯一基于更新的索引。
以下是演示该问题的示例 8.1.1 响应:
"response":{"numFound":58871,"start":0,"docs":[
{
"id":"11111",
"ExpirationDate":"2018-01-26T00:00:00Z",
"_version_":1641033044033798170,
"IDX_ExpirationDate":["2018-01-26T00:00:00Z"]},
{
"id":"22222",
"ExpirationDate":"2018-02-20T00:00:00Z",
"_version_":1641032965380112384,
"IDX_ExpirationDate":["2018-02-20T00:00:00Z"]},
ExpirationDate 应该在那里,但 IDX_ExpirationDate 不应该。我知道我可能会继续使用日期,但它已被弃用,升级到 8.1.1 的部分原因是使用最新的未弃用的东西 ;-)
我有一个名为 IDX_ExpirationDate 的索引,该索引基于名为 ExpirationDate 的字段,该字段是 4.10.2 中的日期字段:
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
<field name="IDX_ExpirationDate" type="date" indexed="true" stored="false" multiValued="true" />
<field name="ExpirationDate" type = "date" indexed = "true" stored = "true" />
<copyField source="ExpirationDate" dest="IDX_ExpirationDate"/>
在 8.1.1 内核中,我将其配置为更新:
<fieldType name="pdate" class="solr.DatePointField" docValues="true"/>
<field name="IDX_ExpirationDate" type="pdate" indexed="true" stored="false" multiValued="true" />
<field name="ExpirationDate" type = "pdate" indexed = "true" stored = "true" />
<copyField source="ExpirationDate" dest="IDX_ExpirationDate"/>
已修复。
根据 solruser 邮件列表上的 Shawn Heisey 的说法,pdate 类型默认为 docValues=true 和 useDocValuesAsStored="true",这使得它出现在结果中。
所以我通过添加 useDocValuesAsStored="false" 更改了 IDX_ExpirationDate,重新加载了索引,它不再出现在结果中:
<field name="IDX_ExpirationDate" type="pdate" indexed="true" stored="false" multiValued="true" useDocValuesAsStored="false"/>