Module: Stanford::Mods::SearchworksSubjects
- Included in:
- Record
- Defined in:
- lib/stanford-mods/concerns/searchworks_subjects.rb
Instance Method Summary collapse
-
#era_facet ⇒ Array<String>
subject/temporal values with trailing comma, semicolon, and backslash (and any preceding spaces) removed.
-
#geographic_facet ⇒ Array<String>
geographic_search values with trailing comma, semicolon, and backslash (and any preceding spaces) removed.
-
#geographic_search ⇒ Array<String>
Values are the contents of: subject/geographic subject/hierarchicalGeographic subject/geographicCode (only include the translated value if it isn’t already present from other mods geo fields).
-
#subject_all_search ⇒ Array<String>
Values are the contents of: all subject subelements except subject/cartographic plus genre top level element.
-
#subject_other_search ⇒ Array<String>
Values are the contents of: subject/name subject/occupation - no subelements subject/titleInfo.
-
#subject_other_subvy_search ⇒ Array<String>
Values are the contents of: subject/temporal subject/genre.
-
#topic_facet ⇒ Array<String>
Values are the contents of: subject/topic subject/name subject/title subject/occupation with trailing comma, semicolon, and backslash (and any preceding spaces) removed.
-
#topic_search ⇒ Array<String>
Values are the contents of: mods/subject/topic.
Instance Method Details
#era_facet ⇒ Array<String>
subject/temporal values with trailing comma, semicolon, and backslash (and any preceding spaces) removed
33 34 35 |
# File 'lib/stanford-mods/concerns/searchworks_subjects.rb', line 33 def era_facet strip_punctuation(subject_temporal) end |
#geographic_facet ⇒ Array<String>
geographic_search values with trailing comma, semicolon, and backslash (and any preceding spaces) removed
27 28 29 |
# File 'lib/stanford-mods/concerns/searchworks_subjects.rb', line 27 def geographic_facet strip_punctuation(geographic_search) end |
#geographic_search ⇒ Array<String>
Values are the contents of:
subject/geographic
subject/hierarchicalGeographic
subject/geographicCode (only include the translated value if it isn't already present from other mods geo fields)
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/stanford-mods/concerns/searchworks_subjects.rb', line 42 def geographic_search result = term_values([:subject, :geographic]) || [] # hierarchicalGeographic has sub elements hierarchical_vals = mods_ng_xml.subject.hierarchicalGeographic.map do |hg_node| hg_vals = hg_node.element_children.map(&:text).reject(&:empty?) hg_vals.join(' ') unless hg_vals.empty? end trans_code_vals = mods_ng_xml.subject.geographicCode.translated_value || [] (result + hierarchical_vals + trans_code_vals).compact.uniq end |
#subject_all_search ⇒ Array<String>
Values are the contents of:
all subject subelements except subject/cartographic plus genre top level element
79 80 81 |
# File 'lib/stanford-mods/concerns/searchworks_subjects.rb', line 79 def subject_all_search topic_search + geographic_search + subject_other_search + subject_other_subvy_search end |
#subject_other_search ⇒ Array<String>
Values are the contents of:
subject/name
subject/occupation - no subelements
subject/titleInfo
61 62 63 |
# File 'lib/stanford-mods/concerns/searchworks_subjects.rb', line 61 def subject_other_search subject_occupations + subject_names + subject_titles end |
#subject_other_subvy_search ⇒ Array<String>
Values are the contents of:
subject/temporal
subject/genre
69 70 71 72 73 74 |
# File 'lib/stanford-mods/concerns/searchworks_subjects.rb', line 69 def subject_other_subvy_search vals = Array(subject_temporal) gvals = term_values([:subject, :genre]) vals + Array(gvals) end |
#topic_facet ⇒ Array<String>
Values are the contents of:
subject/topic
subject/name
subject/title
subject/occupation
with trailing comma, semicolon, and backslash (and any preceding spaces) removed
21 22 23 |
# File 'lib/stanford-mods/concerns/searchworks_subjects.rb', line 21 def topic_facet strip_punctuation(subject_topics + subject_names + subject_titles + subject_occupations) end |
#topic_search ⇒ Array<String>
Values are the contents of:
mods/subject/topic
10 11 12 |
# File 'lib/stanford-mods/concerns/searchworks_subjects.rb', line 10 def topic_search subject_topics end |