lib/stanford-mods/searchworks.rb in stanford-mods-0.0.26 vs lib/stanford-mods/searchworks.rb in stanford-mods-0.0.27
- old
+ new
@@ -480,52 +480,51 @@
# select one or more format values from the controlled vocabulary here:
# http://searchworks-solr-lb.stanford.edu:8983/solr/select?facet.field=format&rows=0&facet.sort=index
# based on the dor_content_type
# @return [String] value in the SearchWorks controlled vocabulary
def format
- val=[]
- formats = self.term_values(:typeOfResource)
- genres = self.term_values(:genre)
- issuance = self.term_values([:origin_info,:issuance])
- if formats
- formats.each do |form|
- case form
- when 'text'
- val << 'Thesis' if genres and genres.include? 'thesis'
- val << 'Book' if issuance and issuance.include? 'monographic'
- val << 'Journal/Periodical' if issuance and issuance.include? 'continuing'
- val << 'Journal/Periodical' if genres and genres.include? 'article'
- val << 'Conference Proceedings' if genres and genres.include? 'conference publication'
- val << 'Other' if genres and genres.include? 'student project report'
- val << 'Book' if genres and genres.include? 'technical report'
- val << 'Book' if genres and genres.include? 'report'
- when 'still image'
- val << 'Image'
- when 'mixed material'
- val << 'Manuscript/Archive'
- when 'moving image'
- val << 'Video'
- when 'notated music'
- val << 'Music - Score'
- when 'three dimensional object'
- val <<'Other'
- when 'cartographic'
- val << 'Map/Globe'
- when 'sound recording-musical'
- val << 'Music - Recording'
- when 'sound recording-nonmusical'
- val << 'Sound Recording'
- when 'software, multimedia'
- val << 'Computer File'
+ val = []
+ types = self.term_values(:typeOfResource)
+ if types
+ genres = self.term_values(:genre)
+ issuance = self.term_values([:origin_info,:issuance])
+ types.each do |type|
+ case type
+ when 'cartographic'
+ val << 'Map/Globe'
+ when 'mixed material'
+ val << 'Manuscript/Archive'
+ when 'moving image'
+ val << 'Video'
+ when 'notated music'
+ val << 'Music - Score'
+ when 'software, multimedia'
+ val << 'Computer File'
+ when 'sound recording-musical'
+ val << 'Music - Recording'
+ when 'sound recording-nonmusical'
+ val << 'Sound Recording'
+ when 'still image'
+ val << 'Image'
+ when 'text'
+ val << 'Book' if issuance and issuance.include? 'monographic'
+ val << 'Book' if genres and genres.include? 'book chapter'
+ val << 'Book' if genres and genres.include? 'issue brief'
+ val << 'Book' if genres and genres.include? 'libretto'
+ val << 'Book' if genres and genres.include? 'report'
+ val << 'Book' if genres and genres.include? 'technical report'
+ val << 'Book' if genres and genres.include? 'working paper'
+ val << 'Conference Proceedings' if genres and genres.include? 'conference publication'
+ val << 'Journal/Periodical' if issuance and issuance.include? 'continuing'
+ val << 'Journal/Periodical' if genres and genres.include? 'article'
+ val << 'Other' if genres and genres.include? 'student project report'
+ val << 'Thesis' if genres and genres.include? 'thesis'
+ when 'three dimensional object'
+ val << 'Other'
end
end
end
- if val.length>0
- return val.uniq
- end
- if not self.typeOfResource or self.typeOfResource.length == 0
- []
- end
+ val.uniq
end
# @return [String] value with the numeric catkey in it, or nil if none exists
def catkey
catkey=self.term_values([:record_info,:recordIdentifier])