class DiscoveryIndexer::GeneralMapper
Attributes
Public Class Methods
Initializes an instance from IndexMapper @param [String] druid e.g. ab123cd4567
# File lib/discovery-indexer/general_mapper.rb, line 8 def initialize(druid) @druid = druid end
Public Instance Methods
@return [DiscoveryIndexer::Collection] for each collection druid, or [] if no collection druids
# File lib/discovery-indexer/general_mapper.rb, line 22 def collection_data @collection_data ||= collection_druids.map do |cdruid| DiscoveryIndexer::Collection.new(cdruid) end end
@return [Array<String>] Array of bare druids from rels-ext isMemberOfCollection in public xml (e.g. ['oo000oo0000'])
# File lib/discovery-indexer/general_mapper.rb, line 29 def collection_druids purlxml.collection_druids end
@return [DiscoveryIndexer::Collection] for each constituent druid, or [] if no constituent druids
# File lib/discovery-indexer/general_mapper.rb, line 34 def constituent_data @constituent_data ||= constituent_druids.map do |cdruid| DiscoveryIndexer::Collection.new(cdruid) end end
@return [Array<String>] Array of bare druids from rels-ext isConstituentOf in public xml (e.g. ['oo000oo0000'])
# File lib/discovery-indexer/general_mapper.rb, line 41 def constituent_druids purlxml.constituent_druids end
Create a Hash representing a Solr doc, with all MODS related fields populated. @return [Hash] Hash representing the Solr document
# File lib/discovery-indexer/general_mapper.rb, line 14 def convert_to_solr_doc solr_doc = {} solr_doc[:id] = druid solr_doc[:title] = modsxml.sw_full_title solr_doc end
@return [Stanford::Mods::Record] the MODS xml for the druid
# File lib/discovery-indexer/general_mapper.rb, line 46 def modsxml @modsxml ||= DiscoveryIndexer::InputXml::Modsxml.new(druid).load end
@return [DiscoveryIndexer::Reader::PurlxmlModel] the purlxml model
# File lib/discovery-indexer/general_mapper.rb, line 51 def purlxml @purlxml ||= DiscoveryIndexer::InputXml::Purlxml.new(druid).load end