diff --git a/app/models/activity.rb b/app/models/activity.rb index 0511e6aef..632db7da4 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -4,8 +4,6 @@ class Activity < Audited::Audit # include helper module for Elasticsearch include Indexable - delegate :uid, to: :doi - alias_attribute :created, :created_at alias_attribute :doi_id, :uid alias_attribute :changes, :audited_changes @@ -30,6 +28,7 @@ def after_audit indexes :version, type: :keyword indexes :request_uuid, type: :keyword indexes :changes, type: :object, properties: { + doi: { type: :keyword }, url: { type: :text, fields: { keyword: { type: "keyword" }}}, creators: { type: :object, properties: { nameType: { type: :keyword }, @@ -234,4 +233,8 @@ def self.index_by_id(options={}) count end + + def uid + doi.present? ? doi.uid : changes.to_h['doi'] + end end \ No newline at end of file