Class: Hyrax::Indexers::PcdmObjectIndexer

Inherits:
ResourceIndexer show all
Includes:
LocationIndexer, PermissionIndexer, ThumbnailIndexer, VisibilityIndexer
Defined in:
app/indexers/hyrax/indexers/pcdm_object_indexer.rb

Overview

Indexes nonā€fileset PCDM objects

Direct Known Subclasses

ValkyrieWorkIndexer

Instance Attribute Summary

Attributes inherited from ResourceIndexer

#resource

Instance Method Summary collapse

Methods included from ThumbnailIndexer

#index_thumbnails, #thumbnail_path

Methods inherited from ResourceIndexer

for, #generate_solr_document, #initialize

Constructor Details

This class inherits a constructor from Hyrax::Indexers::ResourceIndexer

Instance Method Details

#to_solrObject

rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/indexers/hyrax/indexers/pcdm_object_indexer.rb', line 14

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]
    admin_set_label = admin_set_label(resource)
    solr_doc['admin_set_sim']   = admin_set_label
    solr_doc['admin_set_tesim'] = admin_set_label
    solr_doc["#{Hyrax.config.admin_set_predicate.qname.last}_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]
    solr_doc['hasRelatedMediaFragment_ssim'] = [resource.representative_id.to_s]
    solr_doc['hasRelatedImage_ssim'] = [resource.thumbnail_id.to_s]
    solr_doc['hasFormat_ssim'] = resource.rendering_ids.map(&:to_s) if resource.rendering_ids.present?
    index_embargo(solr_doc)
    index_lease(solr_doc)
  end
end