Solr 使用 ttl 字段的默认值自动删除
Solr auto delete using default value of ttl field
我正在尝试将 Solr 自动删除功能与 solr-6 一起使用。我在我的 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 字段。
是否可以做我想做的事?
如果是,那我该怎么做?如果您需要任何进一步的详细信息,请发表评论。
我无法通过 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>
我更改值以进行更快的测试 :) Link 工作 code
我正在尝试将 Solr 自动删除功能与 solr-6 一起使用。我在我的 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 字段。
是否可以做我想做的事? 如果是,那我该怎么做?如果您需要任何进一步的详细信息,请发表评论。
我无法通过 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>
我更改值以进行更快的测试 :) Link 工作 code