Sha256: 91206e1a48d9d8e1a68c8935c410f28135810f77d5eb3aa5fa26510e03dd9f2d

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

# -*- encoding : utf-8 -*-
class Item 

  include Blacklight::Solr::Document    
      # The following shows how to setup this blacklight document to display marc documents
  extension_parameters[:marc_source_field] = :marc_display
  extension_parameters[:marc_format_type] = :marcxml
  use_extension( Blacklight::Solr::Document::Marc) do |document|
    document.key?( :marc_display  )
  end
  
  field_semantics.merge!(    
                         :title => "title_display",
                         :author => "author_display",
                         :language => "language_facet",
                         :format => "format"
                         )



  # self.unique_key = 'id'
  
  # Email uses the semantic field mappings below to generate the body of an email.
  SolrDocument.use_extension( Blacklight::Document::Email )
  
  # SMS uses the semantic field mappings below to generate the body of an SMS email.
  SolrDocument.use_extension( Blacklight::Document::Sms )

  # DublinCore uses the semantic field mappings below to assemble an OAI-compliant Dublin Core document
  # Semantic mappings of solr stored fields. Fields may be multi or
  # single valued. See Blacklight::Document::SemanticFields#field_semantics
  # and Blacklight::Document::SemanticFields#to_semantic_values
  # Recommendation: Use field names from Dublin Core
  use_extension( Blacklight::Document::DublinCore)    

  def has? f, *values
    # these are shenanigans to find a nested field
    if f.is_a? String and f.index('/')
      f = f.split('/')
      f.inject(self) {|m,v| (m || {})[v]}
    else
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dbla-0.0.2 lib/generators/dbla/templates/item.rb
dbla-0.0.1 lib/generators/dbla/templates/item.rb