Class: Dor::SimpleDublinCoreDs
- Inherits:
-
ActiveFedora::OmDatastream
- Object
- ActiveFedora::OmDatastream
- Dor::SimpleDublinCoreDs
- Defined in:
- lib/dor/datastreams/simple_dublin_core_ds.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.xml_template ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dor/datastreams/simple_dublin_core_ds.rb', line 16 def self.xml_template builder = Nokogiri::XML::Builder.new do |xml| xml.dc(:xmlns => 'http://www.openarchives.org/OAI/2.0/oai_dc/', 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/') { xml['dc'].title xml['dc'].creator xml['dc'].identifier } end builder.doc end |
Instance Method Details
#to_solr(solr_doc = {}, *args) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dor/datastreams/simple_dublin_core_ds.rb', line 28 def to_solr(solr_doc = {}, *args) # There are a whole bunch of namespace-related things that can go # wrong with this terminology. Until it's fixed in OM, ignore them all. doc = super solr_doc, *args add_solr_value(doc, 'dc_title', title.first, :string, [:stored_sortable, :stored_searchable]) add_solr_value(doc, 'dc_creator', creator.first, :string, [:stored_sortable, :stored_searchable]) identifiers = {} identifier.each { |i| ns, val = i.split(':'); identifiers[ns] ||= val } identifiers.each do |ns, val| add_solr_value(doc, "dc_identifier_#{ns}", val, :string, [:stored_sortable, :stored_searchable]) end return doc rescue Exception => e warn "ERROR in SimpleDublinCoreDs to_solr()! #{e}" solr_doc end |