1

我正在使用 DataImportHandler 来索引来自 Postgres 的数据

我想获取记录创建时间,以便稍后将其与实际对象创建时间进行比较

这些记录正在更新(通过 id),所以添加“NOW”字段不会成功

4

1 回答 1

1

这就是我最终的做法:

1.使用多值

架构.xml:

<field name="creation_time"  type="date" indexed="false"  stored="true" required="false" multiValued="true" />

2、将FirstFieldValueUpdateProcessorFactory添加到更新流程链中,只会保留第一个值

updateRequestProcessorChain 下的 solrconfig.xml:

<processor class="solr.FirstFieldValueUpdateProcessorFactory">
  <str name="fieldName">creation_time</str>
</processor>

3. 索引时在此字段上使用 solr 4.0 atomic update "add":

{"creation_time": {"add":"2012-03-06T15:02:45.017Z"}}

解决方案取自这里:

https://issues.apache.org/jira/browse/SOLR-4468

于 2013-11-09T07:56:45.723 回答