Sha256: 0c8023f6366d4637ba96995866e8e5535b8c86dff5f686ecc0179f4e59ec02eb

Contents?: true

Size: 1019 Bytes

Versions: 4

Compression:

Stored size: 1019 Bytes

Contents

# frozen_string_literal: true

module Hyrax
  ##
  # Indexes Hyrax::Work objects
  class ValkyrieWorkIndexer < Hyrax::ValkyrieIndexer
    include Hyrax::ResourceIndexer
    include Hyrax::PermissionIndexer
    include Hyrax::VisibilityIndexer
    include Hyrax::Indexer(:core_metadata)

    def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
      super.tap do |solr_doc|
        solr_doc['generic_type_si'] = 'Work'
        solr_doc['suppressed_bsi'] = suppressed?(resource)
        solr_doc['admin_set_id_ssim'] = [resource.admin_set_id.to_s]
        solr_doc['member_of_collection_ids_ssim'] = resource.member_of_collection_ids.map(&:to_s)
        solr_doc['member_ids_ssim'] = resource.member_ids.map(&:to_s)
        solr_doc['depositor_ssim'] = [resource.depositor]
        solr_doc['depositor_tesim'] = [resource.depositor]
      end
    end

    private

    def suppressed?(resource)
      Hyrax::ResourceStatus.new(resource: resource).inactive?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hyrax-3.3.0 app/indexers/hyrax/valkyrie_work_indexer.rb
hyrax-3.2.0 app/indexers/hyrax/valkyrie_work_indexer.rb
hyrax-3.1.0 app/indexers/hyrax/valkyrie_work_indexer.rb
hyrax-3.0.2 app/indexers/hyrax/valkyrie_work_indexer.rb