Skip to content

Commit

Permalink
Merge pull request #402 from UNC-Libraries/hyc-731-edtf-date-oai
Browse files Browse the repository at this point in the history
Add edtf formatted date issued for oai feed
  • Loading branch information
cazzerson authored Jun 5, 2019
2 parents a83dce3 + 5dedc95 commit 7023db4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/indexers/hyc_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class HycIndexer < Hyrax::WorkIndexer
def generate_solr_document
super.tap do |solr_doc|
solr_doc['date_issued_tesim'] = Array(object.date_issued).map {|date| Hyc::EdtfConvert.convert_from_edtf(date)} unless object.date_issued.blank?
solr_doc['date_issued_edtf_tesim'] = Array(object.date_issued).map {|date| Date.parse(date).strftime('%Y-%m-%d')} unless object.date_issued.blank?
end
end
end
6 changes: 5 additions & 1 deletion app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SolrDocument
'project_director_display_tesim', 'researcher_display_tesim', 'reviewer_display_tesim',
'translator_display_tesim'],
publisher: ['publisher_tesim', 'degree_granting_institution_tesim'],
date: ['date_issued_tesim', 'graduation_year_tesim'],
date: ['date_issued_edtf_tesim', 'graduation_year_tesim'],
description: ['abstract_tesim', 'degree_tesim'],
subject: ['subject_tesim', 'keyword_tesim'],
coverage: 'based_near_label_tesim',
Expand Down Expand Up @@ -136,6 +136,10 @@ def date_issued
self[Solrizer.solr_name('date_issued')]
end

def date_issued_edtf
self[Solrizer.solr_name('date_issued_edtf')]
end

def date_other
self[Solrizer.solr_name('date_other')]
end
Expand Down

0 comments on commit 7023db4

Please sign in to comment.