This extractor is useful when you need to parse a local date-time and get a time-of-day (or something similar) from there to catch a seasonality: maybe visitor behavior is different on morning and in evening? Given the event:
-name:timetype:local_timeparse:time_of_day // can be day_of_week/time_of_day/day_of_month/month_of_year/year/secondsource:ranking.localts // can only work with ranking event types, the field must be string with ISO-formatted zoned datetime
This extractor will pull the 10:15:30+01:00, and map it into a 0..23.99 range, so one second before midnight will be 0.99, and midday will be 0.5.
This extractor can use both a separate field or an event-level ranking.timestamp one.
Supported parse field values:
day_of_week: day number in 1..7 range, where Monday is 1
time_of_day: local time in 0.0..23.99 range
day_of_month: day of current month in 1..31 range
month_of_year: current month in 1..12 range
year: absolute current year value
second: current local timestamp in seconds from epoch start
item_age
Sometimes it can be useful to know how fresh is the item in the ranking? Consider the following item metadata event:
It's possible to compute how much time has passed from the created_at field value till now, with the following config snippet:
The source field should have any of the following types:
- name: freshness
type: item_age
source: item.created_at // can only work with item metadata event types
refresh: 0s // optional, how frequently we should update the value, 0s by default
ttl: 90d // optional, how long should we store this field