Class: Hyrax::ValkyrieWorkIndexer

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

Overview

Indexes Hyrax::Work objects

Instance Attribute Summary

Attributes inherited from ValkyrieIndexer

#resource

Instance Method Summary collapse

Methods included from ThumbnailIndexer

#index_thumbnails, #thumbnail_path

Methods inherited from ValkyrieIndexer

for, #generate_solr_document, #initialize

Constructor Details

This class inherits a constructor from Hyrax::ValkyrieIndexer

Instance Method Details

#to_solrObject

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


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/indexers/hyrax/valkyrie_work_indexer.rb', line 13

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]
  end
end