【问题标题】:How to get recored creation time in solr?如何在solr中获得记录的创建时间?
【发布时间】:2013-11-11 13:51:56
【问题描述】:

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

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

这些记录正在更新(通过 id),因此添加“NOW”字段不会起作用

【问题讨论】:

标签: apache solr indexing dataimporthandler


【解决方案1】:

这就是我最终的做法:

1.使用多值

schema.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

【讨论】:

    猜你喜欢
    • 2020-12-14
    • 2022-01-14
    • 2015-12-28
    • 1970-01-01
    • 2012-11-30
    • 2017-02-21
    • 2018-01-08
    • 2021-04-27
    • 1970-01-01
    相关资源
    最近更新 更多