Sha256: 04f2837981021c9bce8f105f56f99e365bb8433ce8946949088a2d8e3ed5a414

Contents?: true

Size: 901 Bytes

Versions: 16

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module ThumbnailIndexer
    extend ActiveSupport::Concern

    included do
      class_attribute :thumbnail_path_service
      self.thumbnail_path_service = ThumbnailPathService
      class_attribute :thumbnail_field
      self.thumbnail_field = :thumbnail_path_ss
    end

    # Adds thumbnail indexing to the solr document of a valkyrie resource
    def to_solr
      super.tap do |solr_doc|
        index_thumbnails(solr_doc)
      end
    end

    # Write the thumbnail paths into the solr_document
    # @param [Hash] solr_document the solr document to add the field to
    def index_thumbnails(solr_document)
      solr_document[thumbnail_field] = thumbnail_path.to_s
    end

    # Returns the value for the thumbnail path to put into the solr document
    def thumbnail_path
      self.class.thumbnail_path_service.call(resource)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/indexers/concerns/hyrax/thumbnail_indexer.rb
hyrax-5.0.0 app/indexers/concerns/hyrax/thumbnail_indexer.rb
hyrax-5.0.0.rc3 app/indexers/concerns/hyrax/thumbnail_indexer.rb
hyrax-5.0.0.rc2 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-5.0.0.rc1 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-3.6.0 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-4.0.0 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-4.0.0.rc3 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-4.0.0.rc2 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-4.0.0.rc1 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-3.5.0 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-4.0.0.beta2 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-3.4.2 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-4.0.0.beta1 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-3.4.1 app/indexers/hyrax/thumbnail_indexer.rb
hyrax-3.4.0 app/indexers/hyrax/thumbnail_indexer.rb