如何在 Solr 中计算来自 "time to live" (TTL) 的文档的过期字段值?
How expiration field values for documents from a "time to live" (TTL) is calculated in Solr?
我浏览了 Java-doc @ DocExpirationUpdateProcessorFactory 。它说:
The DocExpirationUpdateProcessorFactory provides two features related
to the "expiration" of documents which can be used individually, or in
combination:
- Computing expiration field values for documents from a "time to live" (TTL)
- Periodically delete documents from the index based on an expiration field
但它没有指定如何从 ttl 字段计算 expirationField 值。
谁能帮忙看看是怎么计算的?
ttlFieldName
- Name of a field this process should look for in each document processed, defaulting to _ttl_
. If the specified field name exists in a document, the document field value will be parsed as a Date Math Expression relative to NOW and the result will be added to the document using the expirationFieldName
.
这意味着您可以在 _ttl_
字段中使用 +2 HOURS
之类的术语,使文档在被索引后两小时后过期。然后,此日期值将存储在 expirationFieldName
字段中。
来自 Cloudera's documentation about the introduction of the feature:
Current Time is: 2016-10-26 20:14:00
_ttl_
is defined as: +2HOURS
This will result in an expiration value of 2016-10-26 22:14:00
有also more examples in Lucidworks description of the feature:
{ "id" : "live_2_minutes_b",
"time_to_live_s" : "+120SECONDS"
},
我浏览了 Java-doc @ DocExpirationUpdateProcessorFactory 。它说:
The DocExpirationUpdateProcessorFactory provides two features related to the "expiration" of documents which can be used individually, or in combination:
- Computing expiration field values for documents from a "time to live" (TTL)
- Periodically delete documents from the index based on an expiration field
但它没有指定如何从 ttl 字段计算 expirationField 值。
谁能帮忙看看是怎么计算的?
ttlFieldName
- Name of a field this process should look for in each document processed, defaulting to_ttl_
. If the specified field name exists in a document, the document field value will be parsed as a Date Math Expression relative to NOW and the result will be added to the document using theexpirationFieldName
.
这意味着您可以在 _ttl_
字段中使用 +2 HOURS
之类的术语,使文档在被索引后两小时后过期。然后,此日期值将存储在 expirationFieldName
字段中。
来自 Cloudera's documentation about the introduction of the feature:
Current Time is:
2016-10-26 20:14:00
_ttl_
is defined as: +2HOURSThis will result in an expiration value of
2016-10-26 22:14:00
有also more examples in Lucidworks description of the feature:
{ "id" : "live_2_minutes_b",
"time_to_live_s" : "+120SECONDS"
},