Class: Dor::SimpleDublinCoreDs

Inherits:
ActiveFedora::OmDatastream
  • Object
show all
Defined in:
lib/dor/datastreams/simple_dublin_core_ds.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.xml_templateObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dor/datastreams/simple_dublin_core_ds.rb', line 18

def self.xml_template
  builder = Nokogiri::XML::Builder.new do |xml|
    xml['oai_dc'].dc(
      'xmlns:oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',
      'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
      'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
      'xsi:schemaLocation' => 'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
    )
  end

  builder.doc
end

Instance Method Details

#prefixObject

maintain AF < 8 indexing behavior



55
56
57
# File 'lib/dor/datastreams/simple_dublin_core_ds.rb', line 55

def prefix
  ''
end

#to_solr(solr_doc = {}, *args) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/dor/datastreams/simple_dublin_core_ds.rb', line 31

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