Clamp dates when serializing to Elasticsearch API (#28081)

This commit is contained in:
Claire 2023-11-27 14:25:54 +01:00 committed by KMY
parent 18af335d69
commit 6072ab23d7
5 changed files with 26 additions and 4 deletions

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class StatusesIndex < Chewy::Index
include DatetimeClampingConcern
DEVELOPMENT_SETTINGS = {
filter: {
english_stop: {
@ -184,6 +186,6 @@ class StatusesIndex < Chewy::Index
field(:language, type: 'keyword')
field(:domain, type: 'keyword', value: ->(status) { status.account.domain || '' })
field(:properties, type: 'keyword', value: ->(status) { status.searchable_properties })
field(:created_at, type: 'date')
field(:created_at, type: 'date', value: ->(status) { clamp_date(status.created_at) })
end
end