Sha256: dc3aef270008d8a964c9ba02100ac7b5c4c92fa5e386e8f266be5bb03434bb37

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

module Hyrax
  module Listeners
    ##
    # Reindexes resources when their metadata is updated.
    #
    # @note This listener makes no attempt to avoid reindexing when no metadata
    #   has actually changed, or when real metadata changes won't impact the
    #   indexed data. We trust that published metadata update events represent
    #   actual changes to object metadata, and that the indexing adapter
    #   optimizes reasonably for actual index document contents.
    class MetadataIndexListener
      ##
      # Re-index the resource.
      #
      # @param event [Dry::Event]
      def on_object_metadata_updated(event)
        Hyrax.index_adapter.save(resource: event[:object])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyrax-3.0.0.pre.rc3 app/services/hyrax/listeners/metadata_index_listener.rb
hyrax-3.0.0.pre.rc2 app/services/hyrax/listeners/metadata_index_listener.rb