Sha256: 69209ced9568433b13613db46418de8cee381fcb566a7c1dc8d6e874a2f6627e

Contents?: true

Size: 888 Bytes

Versions: 29

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module IndexesThumbnails
    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
    def generate_solr_document
      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
    end

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

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
hyrax-5.1.0.pre.beta1 app/services/hyrax/indexes_thumbnails.rb
hyrax-5.0.4 app/services/hyrax/indexes_thumbnails.rb
hyrax-5.0.3 app/services/hyrax/indexes_thumbnails.rb
hyrax-5.0.2 app/services/hyrax/indexes_thumbnails.rb
hyrax-5.0.1 app/services/hyrax/indexes_thumbnails.rb
hyrax-5.0.0 app/services/hyrax/indexes_thumbnails.rb
hyrax-5.0.0.rc3 app/services/hyrax/indexes_thumbnails.rb
hyrax-5.0.0.rc2 app/services/hyrax/indexes_thumbnails.rb
hyrax-5.0.0.rc1 app/services/hyrax/indexes_thumbnails.rb
hyrax-3.6.0 app/services/hyrax/indexes_thumbnails.rb
hyrax-4.0.0 app/services/hyrax/indexes_thumbnails.rb
hyrax-4.0.0.rc3 app/services/hyrax/indexes_thumbnails.rb
hyrax-4.0.0.rc2 app/services/hyrax/indexes_thumbnails.rb
hyrax-4.0.0.rc1 app/services/hyrax/indexes_thumbnails.rb
hyrax-3.5.0 app/services/hyrax/indexes_thumbnails.rb
hyrax-4.0.0.beta2 app/services/hyrax/indexes_thumbnails.rb
hyrax-3.4.2 app/services/hyrax/indexes_thumbnails.rb
hyrax-4.0.0.beta1 app/services/hyrax/indexes_thumbnails.rb
hyrax-3.4.1 app/services/hyrax/indexes_thumbnails.rb
hyrax-3.4.0 app/services/hyrax/indexes_thumbnails.rb