我正在尝试使用solr-6的Solr自动删除功能。我在我的managed-schema.xml和solrconfig.xml中做了以下更改。
托管架构
<!--expiration date field-->
<field name="eDate" type="date" multiValued="false" indexed="true" stored="true"/>
<field name="ttl" type="string" multiValued="false" indexed="true" stored="true" default="+90SECONDS"/>solrconfig
<processor class="solr.processor.DocExpirationUpdateProcessorFactory">
<int name="autoDeletePeriodSeconds">30</int>
<str name="ttlFieldName">ttl</str>
<str name="expirationFieldName">eDate</str>
</processor>如果我在传入的文档中显式地设置了ttl字段,或者在更新请求中设置了ttl请求参数,我就能够像预期的那样使用自动删除功能。但是,如果我没有显式地设置ttl字段,我希望使用管理架构中指定的ttl的默认值。当我尝试这样做时,使用默认值生成了ttl字段,但没有生成相应的eDate字段。
有没有可能做我想做的事?如果是,那我该怎么做呢?如果您需要任何进一步的详细信息,请留下评论。
发布于 2017-01-18 15:18:32
我无法通过field描述中的default参数使其工作,但我通过添加solr.DefaultValueUpdateProcessorFactory使其工作
在我的更新链中,我有这个:
<processor class="solr.DefaultValueUpdateProcessorFactory">
<str name="fieldName">ttl</str>
<str name="value">+15SECONDS</str>
</processor>
<processor class="solr.processor.DocExpirationUpdateProcessorFactory">
<int name="autoDeletePeriodSeconds">5</int>
<str name="ttlFieldName">ttl</str>
<str name="expirationFieldName">eDate</str>
</processor>我更改了值以进行更快的测试:)指向工作code的链接
https://stackoverflow.com/questions/41711740
复制相似问题