cul_scv_hydra 0.16.1 → 0.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/models/cul/scv/hydra/datastreams/dc_metadata.rb +5 -5
- data/app/models/cul/scv/hydra/datastreams/mods_document.rb +31 -15
- data/config/locales/ldpd_hydra.en.yml +22 -16
- data/config/solr_value_maps.yml +24 -16
- data/lib/cul_scv_hydra/om/standard_mods.rb +6 -6
- data/lib/cul_scv_hydra/solrizer/field_mapper.rb +20 -10
- data/lib/cul_scv_hydra/solrizer/scv_mods_fieldable.rb +63 -5
- data/lib/cul_scv_hydra/solrizer/value_mapper.rb +1 -1
- data/lib/cul_scv_hydra/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWJjMjhkYjdmOTM2ZWJlNjNkOTUxOTczMmVkMTJmOTZjOGVlMWMxYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGU3ZDI0NTczMzNmMDI4NTEyYjg0NTQzYzhmODZjMmNlY2Q5ZmE0OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWVjMmYxNThmMDJiN2Y4NGYxNjUwM2Q5YzA1MTVlMjZmNWFhYzhiYjExZmFh
|
10
|
+
M2I2NGYzNzBjMTgxMGYwZWI4ZDU1Y2NkMDI4YjRhNzlmZjEwZDQ4YjAwMTQw
|
11
|
+
Zjg3MTc3ZDM2NDUxY2UwNjZkZTMyOTFhOWY2ODRkNzM1MmRkZjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmM1ZDliNDIxMjM4ZjIzMTIzM2Q0Y2QyN2U2NzVhZTdlYjkzNzg3NDdmNDY0
|
14
|
+
MTQ0ZjVkYTNkYzQxYzZjYzhjMzM1YzIxY2FlYzhiZmUxYmIwMGNjMWIyZjdk
|
15
|
+
OGVmMWJkOWQ2MWZlNmNmYTdiZGI3OWE0ZWMyYjYyNDljY2YzY2Q=
|
@@ -11,7 +11,7 @@ class DCMetadata < ::ActiveFedora::OmDatastream
|
|
11
11
|
"xmlns:oai_dc"=>"http://www.openarchives.org/OAI/2.0/oai_dc/",
|
12
12
|
"xmlns:dc"=>"http://purl.org/dc/elements/1.1/",
|
13
13
|
:schema=>"http://www.openarchives.org/OAI/2.0/oai_dc.xsd")
|
14
|
-
t.dc_contributor(:path=>"contributor",
|
14
|
+
t.dc_contributor(:path=>"contributor",
|
15
15
|
:namespace_prefix=>"dc",
|
16
16
|
:index_as=>[:displayable, :searchable])
|
17
17
|
t.dc_coverage(:path=>"coverage",
|
@@ -79,9 +79,9 @@ src
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def prefix
|
82
|
-
if ::ActiveFedora::VERSION >= '8'
|
83
|
-
|
84
|
-
end
|
82
|
+
#if ::ActiveFedora::VERSION >= '8'
|
83
|
+
# Rails.logger.warn("the prefix method of #{self.class.name} was overriden to maintain backwards compatibility")
|
84
|
+
#end
|
85
85
|
''
|
86
86
|
end
|
87
87
|
|
@@ -106,4 +106,4 @@ end
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
109
|
-
end
|
109
|
+
end
|
@@ -33,6 +33,11 @@ class ModsDocument < ::ActiveFedora::OmDatastream
|
|
33
33
|
t.search_title_info(:path=>'titleInfo', :index_as=>[]){
|
34
34
|
t.search_title(:path=>'title', :index_as=>[:textable])
|
35
35
|
}
|
36
|
+
t.part(:path=>"relatedItem", :attributes=>{:type=>"constituent"}, :index_as=>[]){
|
37
|
+
t.part_title_info(:path=>'titleInfo', :index_as=>[]){
|
38
|
+
t.lib_part(:path=>'title',:index_as=>[])
|
39
|
+
}
|
40
|
+
}
|
36
41
|
t.project(:path=>"relatedItem", :attributes=>{:type=>"host", :displayLabel=>"Project"}, :index_as=>[]){
|
37
42
|
t.project_title_info(:path=>'titleInfo', :index_as=>[]){
|
38
43
|
t.lib_project(:path=>'title',:index_as=>[])
|
@@ -43,15 +48,16 @@ class ModsDocument < ::ActiveFedora::OmDatastream
|
|
43
48
|
t.lib_collection(:path=>'title', :index_as=>[])
|
44
49
|
}
|
45
50
|
}
|
46
|
-
t.lib_project(:proxy=>[:project,:project_title_info],
|
47
|
-
:index_as=>[:displayable, :searchable, :project_facetable, :project_textable])
|
51
|
+
t.lib_project(:proxy=>[:project,:project_title_info], :index_as=>[:displayable, :searchable, :project_facetable, :project_textable])
|
48
52
|
t.lib_collection(:proxy=>[:collection,:collection_title_info])
|
49
|
-
|
53
|
+
t.lib_part(:proxy=>[:part,:part_title_info], :index_as=>[:displayable, :textable])
|
54
|
+
# pattern matches
|
50
55
|
t.identifier(:path=>"identifier", :attributes=>{:type=>"local"}, :type=>:string, :index_as=>[:symbol, :textable])
|
51
56
|
t.clio(:path=>"identifier", :attributes=>{:type=>"CLIO"}, :data_type=>:symbol, :index_as=>[:symbol, :textable])
|
52
|
-
t.abstract
|
57
|
+
t.abstract(:index_as=>[:displayable, :textable])
|
58
|
+
t.table_of_contents(:path=>"tableOfContents", :index_as=>[:displayable, :textable])
|
53
59
|
t.subject(:index_as=>[:textable]){
|
54
|
-
t.topic(:index_as=>[:facetable])
|
60
|
+
t.topic(:index_as=>[:facetable, :displayable])
|
55
61
|
t.geographic(:index_as=>[:facetable])
|
56
62
|
}
|
57
63
|
t.type_of_resource(:path=>"typeOfResource", :index_as=>[:displayable])
|
@@ -71,9 +77,11 @@ class ModsDocument < ::ActiveFedora::OmDatastream
|
|
71
77
|
t.lib_repo(:path=>"physicalLocation",
|
72
78
|
:attributes=>{:authority=>"marcorg"},
|
73
79
|
:index_as=>[:textable])
|
74
|
-
t.shelf_locator(:path=>"shelfLocator", :index_as=>[:textable])
|
75
|
-
t.sublocation(:path=>"sublocation", :index_as=>[:textable])
|
80
|
+
t.shelf_locator(:path=>"shelfLocator", :index_as=>[:textable, :displayable])
|
81
|
+
t.sublocation(:path=>"sublocation", :index_as=>[:textable, :displayable])
|
82
|
+
t.url
|
76
83
|
}
|
84
|
+
t.top_level_location_url(:proxy=>[:mods, :location, :url])
|
77
85
|
t.lib_repo(:proxy=>[:location, :lib_repo], :type=>:text,
|
78
86
|
:index_as=>[:marc_code_facetable, :marc_code_displayable, :marc_code_textable])
|
79
87
|
t.lib_name(
|
@@ -90,9 +98,7 @@ class ModsDocument < ::ActiveFedora::OmDatastream
|
|
90
98
|
:index_as=>[])
|
91
99
|
}
|
92
100
|
t.note(:path=>"note", :index_as=>[:textable])
|
93
|
-
t.access_condition(:path=>"accessCondition",
|
94
|
-
:attributes=>{:type=>"useAndReproduction"},
|
95
|
-
:index_as => [:searchable, :symbol])
|
101
|
+
t.access_condition(:path=>"accessCondition", :attributes=>{:type=>"useAndReproduction"}, :index_as => [:searchable, :symbol])
|
96
102
|
t.record_info(:path=>"recordInfo", :index_as=>[]) {
|
97
103
|
t.record_creation_date(:path=>"recordCreationDate",:attributes=>{:encoding=>"w3cdtf"}, :index_as=>[])
|
98
104
|
t.record_content_source(:path=>"recordContentSource",:attributes=>{:authority=>"marcorg"}, :index_as=>[])
|
@@ -106,21 +112,31 @@ class ModsDocument < ::ActiveFedora::OmDatastream
|
|
106
112
|
t.language_code(:proxy=>[:record_info, :language_of_cataloging, :language_code])
|
107
113
|
|
108
114
|
t.language(:index_as=>[]){
|
109
|
-
t.language_term_text(:path=>"languageTerm", :attributes=>{:authority=>'iso639-2b',:type=>'text'}, :index_as=>[:facetable, :textable])
|
110
|
-
t.language_term_code(:path=>"languageTerm", :attributes=>{:authority=>'iso639-2b',:type=>'code'}, :index_as=>[:facetable, :textable])
|
115
|
+
t.language_term_text(:path=>"languageTerm", :attributes=>{:authority=>'iso639-2b',:type=>'text'}, :index_as=>[:facetable, :displayable, :textable])
|
116
|
+
t.language_term_code(:path=>"languageTerm", :attributes=>{:authority=>'iso639-2b',:type=>'code'}, :index_as=>[:facetable, :displayable, :textable])
|
111
117
|
}
|
112
118
|
|
113
119
|
t.origin_info(:path=>"originInfo", :index_as=>[]){
|
114
120
|
t.date_issued(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes'}, :index_as=>[:displayable, :textable])
|
115
121
|
t.date_issued_start(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes',:point=>'start'}, :index_as=>[:displayable, :textable])
|
116
122
|
t.date_issued_end(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:point=>'end'}, :index_as=>[:displayable, :textable])
|
123
|
+
t.date_issued_textual(:path=>"dateIssued", :attributes=>{:encoding=>:none, :keyDate=>:none}, :index_as=>[:textable])
|
124
|
+
|
117
125
|
t.date_created(:path=>"dateCreated", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes'}, :index_as=>[:displayable, :textable])
|
118
126
|
t.date_created_start(:path=>"dateCreated", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes',:point=>'start'}, :index_as=>[:displayable, :textable])
|
119
127
|
t.date_created_end(:path=>"dateCreated", :attributes=>{:encoding=>'w3cdtf',:point=>'end'}, :index_as=>[:displayable, :textable])
|
128
|
+
t.date_created_textual(:path=>"dateCreated", :attributes=>{:encoding=>:none, :keyDate=>:none}, :index_as=>[:textable])
|
129
|
+
|
120
130
|
t.date_other(:path=>"dateOther", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes'}, :index_as=>[:displayable, :textable])
|
121
131
|
t.date_other_start(:path=>"dateOther", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes',:point=>'start'}, :index_as=>[:displayable, :textable])
|
122
132
|
t.date_other_end(:path=>"dateOther", :attributes=>{:encoding=>'w3cdtf',:point=>'end'}, :index_as=>[:displayable, :textable])
|
133
|
+
t.date_other_textual(:path=>"dateOther", :attributes=>{:encoding=>:none, :keyDate=>:none}, :index_as=>[:textable])
|
134
|
+
|
135
|
+
t.publisher(:index_as=>[:displayable])
|
136
|
+
t.place(:index_as=>[:displayable])
|
137
|
+
t.edition(:index_as=>[:displayable])
|
123
138
|
}
|
139
|
+
t.lib_publisher(:proxy=>[:mods, :origin_info, :publisher], :index_as=>[:displayable])
|
124
140
|
end
|
125
141
|
|
126
142
|
def self.xml_template
|
@@ -138,9 +154,9 @@ class ModsDocument < ::ActiveFedora::OmDatastream
|
|
138
154
|
end
|
139
155
|
|
140
156
|
def prefix
|
141
|
-
if ::ActiveFedora::VERSION >= '8'
|
142
|
-
|
143
|
-
end
|
157
|
+
#if ::ActiveFedora::VERSION >= '8'
|
158
|
+
# Rails.logger.warn("the prefix method of #{self.class.name} was overriden to maintain backwards compatibility")
|
159
|
+
#end
|
144
160
|
''
|
145
161
|
end
|
146
162
|
|
@@ -2,17 +2,20 @@ en:
|
|
2
2
|
ldpd:
|
3
3
|
short:
|
4
4
|
repo:
|
5
|
-
'NNC' : 'General Collections'
|
6
|
-
'NNC-A' : 'Avery'
|
7
|
-
'NNC-ART' : 'Office of Art Properties'
|
8
5
|
'NNBa' : 'Barnard College Library'
|
9
|
-
'NNC
|
6
|
+
'NNC' : 'Butler Library'
|
7
|
+
'NNC-A' : 'Avery Library'
|
8
|
+
'NNC-ART' : 'Office of Art Properties'
|
9
|
+
'NNC-EA' : 'East Asian Library'
|
10
10
|
'NNC-L' : 'Law Library'
|
11
11
|
'NNC-M' : 'Health Sciences Library'
|
12
12
|
'NNC-MUS' : 'Music Library'
|
13
|
-
'NNC-RB' : '
|
13
|
+
'NNC-RB' : 'Rare Book Library'
|
14
|
+
'NNC-UA' : 'University Archives'
|
14
15
|
'NyNyCBL' : 'Burke Library'
|
15
|
-
'NyNyCOH' : '
|
16
|
+
'NyNyCOH' : 'Oral History'
|
17
|
+
'NyNyCAP' : 'Art Properties'
|
18
|
+
'NyNyCMA' : 'Music Library'
|
16
19
|
'UkWC-A' : 'Royal Archives, Windsor Castle'
|
17
20
|
project:
|
18
21
|
'Customer Order Collection' : 'Pres Orders'
|
@@ -20,20 +23,23 @@ en:
|
|
20
23
|
"Jewels in her crown: treasures of Columbia University Libraries special collections" : 'Jewels in her Crown'
|
21
24
|
"Russian Imperial Corps of Pages" : 'Russian Corps of Pages'
|
22
25
|
"Preserving Historic Audio Content" : 'Audio Preservation'
|
23
|
-
'Papers of John Jay' : 'John Jay Papers'
|
26
|
+
'The Papers of John Jay' : 'John Jay Papers'
|
24
27
|
'Project Facet Mapping Test' : 'Successful Project Mapping'
|
25
28
|
'G.E.E. Lindquist Native American Photographs' : 'Lindquist Photographs'
|
26
29
|
long:
|
27
30
|
repo:
|
28
|
-
'NNC' : 'General Collections'
|
29
|
-
'NNC-A' : 'Avery Architectural & Fine Arts Library'
|
30
|
-
'NNC-ART' : 'Office of Art Properties'
|
31
31
|
'NNBa' : 'Barnard College Library'
|
32
|
-
'NNC
|
33
|
-
'NNC-
|
34
|
-
'NNC-
|
32
|
+
'NNC' : 'Columbia University Libraries'
|
33
|
+
'NNC-A' : 'Avery Architectural & Fine Arts Library, Columbia University'
|
34
|
+
'NNC-ART' : 'Office of Art Properties'
|
35
|
+
'NNC-EA' : 'C.V. Starr East Asian Library, Columbia University'
|
36
|
+
'NNC-L' : 'Arthur W. Diamond Law Library, Columbia University'
|
37
|
+
'NNC-M' : 'Augustus C. Long Health Sciences Library, Columbia University'
|
35
38
|
'NNC-MUS' : 'Music Library'
|
36
|
-
'NNC-RB' : 'Rare Book
|
37
|
-
'
|
38
|
-
'
|
39
|
+
'NNC-RB' : 'Rare Book & Manuscript Library, Columbia University'
|
40
|
+
'NNC-UA' : 'University Archives, Columbia University'
|
41
|
+
'NyNyCBL' : 'Burke Library at Union Theological Seminary, Columbia University'
|
42
|
+
'NyNyCOH' : 'Columbia Center for Oral History, Columbia University'
|
43
|
+
'NyNyCAP' : 'Art Properties, Columbia University'
|
44
|
+
'NyNyCMA' : 'Gabe M. Wiener Music & Arts Library, Columbia University'
|
39
45
|
'UkWC-A' : 'Royal Archives, Windsor Castle'
|
data/config/solr_value_maps.yml
CHANGED
@@ -1,33 +1,41 @@
|
|
1
1
|
:marc_to_facet :
|
2
|
-
'NNC' : 'General Collections'
|
3
|
-
'NNC-A' : 'Avery'
|
4
|
-
'NNC-ART' : 'Office of Art Properties'
|
5
2
|
'NNBa' : 'Barnard College Library'
|
6
|
-
'NNC
|
3
|
+
'NNC' : 'Butler Library'
|
4
|
+
'NNC-A' : 'Avery Library'
|
5
|
+
'NNC-ART' : 'Office of Art Properties'
|
6
|
+
'NNC-EA' : 'East Asian Library'
|
7
7
|
'NNC-L' : 'Law Library'
|
8
8
|
'NNC-M' : 'Health Sciences Library'
|
9
9
|
'NNC-MUS' : 'Music Library'
|
10
|
-
'NNC-RB' : '
|
10
|
+
'NNC-RB' : 'Rare Book Library'
|
11
|
+
'NNC-UA' : 'University Archives'
|
11
12
|
'NyNyCBL' : 'Burke Library'
|
12
|
-
'NyNyCOH' : '
|
13
|
+
'NyNyCOH' : 'Oral History'
|
14
|
+
'NyNyCAP' : 'Art Properties'
|
15
|
+
'NyNyCMA' : 'Music Library'
|
16
|
+
'UkWC-A' : 'Royal Archives, Windsor Castle'
|
13
17
|
:marc_to_display :
|
14
|
-
'NNC' : 'General Collections'
|
15
|
-
'NNC-A' : 'Avery Architectural & Fine Arts Library'
|
16
|
-
'NNC-ART' : 'Office of Art Properties'
|
17
18
|
'NNBa' : 'Barnard College Library'
|
18
|
-
'NNC
|
19
|
-
'NNC-
|
20
|
-
'NNC-
|
19
|
+
'NNC' : 'Columbia University Libraries'
|
20
|
+
'NNC-A' : 'Avery Architectural & Fine Arts Library, Columbia University'
|
21
|
+
'NNC-ART' : 'Office of Art Properties'
|
22
|
+
'NNC-EA' : 'C.V. Starr East Asian Library, Columbia University'
|
23
|
+
'NNC-L' : 'Arthur W. Diamond Law Library, Columbia University'
|
24
|
+
'NNC-M' : 'Augustus C. Long Health Sciences Library, Columbia University'
|
21
25
|
'NNC-MUS' : 'Music Library'
|
22
|
-
'NNC-RB' : 'Rare Book
|
23
|
-
'
|
24
|
-
'
|
26
|
+
'NNC-RB' : 'Rare Book & Manuscript Library, Columbia University'
|
27
|
+
'NNC-UA' : 'University Archives, Columbia University'
|
28
|
+
'NyNyCBL' : 'Burke Library at Union Theological Seminary, Columbia University'
|
29
|
+
'NyNyCOH' : 'Columbia Center for Oral History, Columbia University'
|
30
|
+
'NyNyCAP' : 'Art Properties, Columbia University'
|
31
|
+
'NyNyCMA' : 'Gabe M. Wiener Music & Arts Library, Columbia University'
|
32
|
+
'UkWC-A' : 'Royal Archives, Windsor Castle'
|
25
33
|
:project_to_facet :
|
26
34
|
'Customer Order Collection' : 'Pres Orders'
|
27
35
|
"Children's Drawings of the Spanish Civil War (online exhibition)" : 'Spanish Civil War'
|
28
36
|
"Jewels in her crown: treasures of Columbia University Libraries special collections" : 'Jewels in her Crown'
|
29
37
|
"Russian Imperial Corps of Pages" : 'Russian Corps of Pages'
|
30
38
|
"Preserving Historic Audio Content" : 'Audio Preservation'
|
31
|
-
'Papers of John Jay' : 'John Jay Papers'
|
39
|
+
'The Papers of John Jay' : 'John Jay Papers'
|
32
40
|
'Project Facet Mapping Test' : 'Successful Project Mapping'
|
33
41
|
'G.E.E. Lindquist Native American Photographs' : 'Lindquist Photographs'
|
@@ -6,7 +6,7 @@ module Scv
|
|
6
6
|
module Hydra
|
7
7
|
module Om
|
8
8
|
class StandardMods < ::ActiveFedora::OmDatastream
|
9
|
-
|
9
|
+
|
10
10
|
set_terminology do |t|
|
11
11
|
t.root(:path=>"mods",
|
12
12
|
:xmlns=>"http://www.loc.gov/mods/v3",
|
@@ -65,10 +65,10 @@ module Om
|
|
65
65
|
t.end_date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:point=>'end'}, :index_as=>[:not_searchable])
|
66
66
|
}
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
def self.xml_template
|
70
70
|
builder = Nokogiri::XML::Builder.new do |xml|
|
71
|
-
xml.mods(:version=>"3.4",
|
71
|
+
xml.mods(:version=>"3.4",
|
72
72
|
"xmlns"=>"http://www.loc.gov/mods/v3",
|
73
73
|
"xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance"){
|
74
74
|
}
|
@@ -79,9 +79,9 @@ module Om
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def prefix
|
82
|
-
if ::ActiveFedora::VERSION >= '8'
|
83
|
-
|
84
|
-
end
|
82
|
+
#if ::ActiveFedora::VERSION >= '8'
|
83
|
+
# Rails.logger.warn("the prefix method of #{self.class.name} was overriden to maintain backwards compatibility")
|
84
|
+
#end
|
85
85
|
''
|
86
86
|
end
|
87
87
|
|
@@ -58,18 +58,21 @@ module Solrizer::DefaultDescriptors
|
|
58
58
|
|
59
59
|
def self.date_sortable_converter
|
60
60
|
lambda do |type|
|
61
|
-
lambda do |val|
|
61
|
+
lambda do |val|
|
62
62
|
begin
|
63
63
|
d = val.length < 11 ? Date.new(*(val.split('-').collect {|s| s.to_i})) : Date.parse(val)
|
64
64
|
iso8601_date(d)
|
65
65
|
rescue ArgumentError
|
66
|
-
nil
|
66
|
+
nil
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
module Normal
|
73
|
+
SHORT_REPO = "ldpd.short.repo."
|
74
|
+
SHORT_PROJ = "ldpd.short.project."
|
75
|
+
LONG_REPO = "ldpd.long.repo."
|
73
76
|
def normal(value)
|
74
77
|
normal!(value.clone)
|
75
78
|
end
|
@@ -78,9 +81,16 @@ module Solrizer::DefaultDescriptors
|
|
78
81
|
value.strip!
|
79
82
|
value
|
80
83
|
end
|
84
|
+
def translate_with_default(prefix, value)
|
85
|
+
begin
|
86
|
+
I18n.t(prefix + value, default: value)
|
87
|
+
rescue
|
88
|
+
value
|
89
|
+
end
|
90
|
+
end
|
81
91
|
end
|
82
92
|
|
83
|
-
class TextableDescriptor < Solrizer::Descriptor
|
93
|
+
class TextableDescriptor < Solrizer::Descriptor
|
84
94
|
include Normal
|
85
95
|
def name_and_converter(field_name, args=nil)
|
86
96
|
super('all_text', args)
|
@@ -98,7 +108,7 @@ module Solrizer::DefaultDescriptors
|
|
98
108
|
def converter(field_type)
|
99
109
|
lambda do |value|
|
100
110
|
if value.is_a? String
|
101
|
-
|
111
|
+
translate_with_default(SHORT_PROJ, normal!(value))
|
102
112
|
else
|
103
113
|
raise "unexpected project_textable #{value.inspect}"
|
104
114
|
value
|
@@ -110,21 +120,21 @@ module Solrizer::DefaultDescriptors
|
|
110
120
|
class ProjectFacetDescriptor < Solrizer::Descriptor
|
111
121
|
include Normal
|
112
122
|
def converter(field_type)
|
113
|
-
lambda {|value|
|
123
|
+
lambda {|value| translate_with_default(SHORT_PROJ, normal!(value))}
|
114
124
|
end
|
115
125
|
end
|
116
126
|
|
117
127
|
class MarcCodeFacetDescriptor < Solrizer::Descriptor
|
118
128
|
include Normal
|
119
129
|
def converter(field_type)
|
120
|
-
lambda {|value|
|
130
|
+
lambda {|value| translate_with_default(SHORT_REPO, normal!(value))}
|
121
131
|
end
|
122
132
|
end
|
123
133
|
|
124
134
|
class MarcCodeDisplayDescriptor < Solrizer::Descriptor
|
125
135
|
include Normal
|
126
136
|
def converter(field_type)
|
127
|
-
lambda {|value|
|
137
|
+
lambda {|value| translate_with_default(LONG_REPO, normal!(value))}
|
128
138
|
end
|
129
139
|
end
|
130
140
|
|
@@ -137,8 +147,8 @@ module Solrizer::DefaultDescriptors
|
|
137
147
|
lambda do |value|
|
138
148
|
if value.is_a? String
|
139
149
|
normal!(value)
|
140
|
-
r = [
|
141
|
-
r <<
|
150
|
+
r = [translate_with_default(SHORT_REPO, normal!(value))]
|
151
|
+
r << translate_with_default(LONG_REPO, normal!(value))
|
142
152
|
r.uniq!
|
143
153
|
r.join(' ')
|
144
154
|
else
|
@@ -147,4 +157,4 @@ module Solrizer::DefaultDescriptors
|
|
147
157
|
end
|
148
158
|
end
|
149
159
|
end
|
150
|
-
end
|
160
|
+
end
|
@@ -116,6 +116,59 @@ module Cul::Scv::Hydra::Solrizer
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
+
def textual_dates(node=mods)
|
120
|
+
dates = []
|
121
|
+
node.xpath("./mods:originInfo/mods:dateCreated[not(@keyDate) and not(@point) and not(@w3cdtf)]", MODS_NS).collect do |n|
|
122
|
+
dates << ScvModsFieldable.normalize(n.text, true)
|
123
|
+
end
|
124
|
+
node.xpath("./mods:originInfo/mods:dateIssued[not(@keyDate) and not(@point) and not(@w3cdtf)]", MODS_NS).collect do |n|
|
125
|
+
dates << ScvModsFieldable.normalize(n.text, true)
|
126
|
+
end
|
127
|
+
node.xpath("./mods:originInfo/mods:dateOther[not(@keyDate) and not(@point) and not(@w3cdtf)]", MODS_NS).collect do |n|
|
128
|
+
dates << ScvModsFieldable.normalize(n.text, true)
|
129
|
+
end
|
130
|
+
return dates
|
131
|
+
end
|
132
|
+
|
133
|
+
def date_range_to_textual_date(start_year, end_year)
|
134
|
+
start_year = start_year.to_i.to_s # Remove zero-padding if present
|
135
|
+
end_year = end_year.to_i.to_s # Remove zero-padding if present
|
136
|
+
|
137
|
+
if start_year == end_year
|
138
|
+
return [start_year]
|
139
|
+
else
|
140
|
+
return [('Between ' +
|
141
|
+
(start_year.to_i > 0 ? start_year : start_year[1,start_year.length] + ' BCE') +
|
142
|
+
' and ' +
|
143
|
+
(end_year.to_i > 0 ? (start_year.to_i > 0 ? end_year : end_year + ' CE') : end_year[1,end_year.length] + ' BCE')
|
144
|
+
)]
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def date_notes(node=mods)
|
149
|
+
date_notes = []
|
150
|
+
node.xpath("./mods:note[@type = 'date' or @type = 'date source']", MODS_NS).collect do |n|
|
151
|
+
date_notes << ScvModsFieldable.normalize(n.text, true)
|
152
|
+
end
|
153
|
+
return date_notes
|
154
|
+
end
|
155
|
+
|
156
|
+
def non_date_notes(node=mods)
|
157
|
+
non_date_notes = []
|
158
|
+
node.xpath("./mods:note[not(@type) or (@type != 'date' and @type != 'date source')]", MODS_NS).collect do |n|
|
159
|
+
non_date_notes << ScvModsFieldable.normalize(n.text, true)
|
160
|
+
end
|
161
|
+
return non_date_notes
|
162
|
+
end
|
163
|
+
|
164
|
+
def item_in_context_url(node=mods)
|
165
|
+
item_in_context_url_val = []
|
166
|
+
node.xpath("./mods:location/mods:url[@access='object in context' and @usage='primary display']", MODS_NS).collect do |n|
|
167
|
+
item_in_context_url_val << ScvModsFieldable.normalize(n.text, true)
|
168
|
+
end
|
169
|
+
item_in_context_url_val
|
170
|
+
end
|
171
|
+
|
119
172
|
def to_solr(solr_doc={})
|
120
173
|
solr_doc = (defined? super) ? super : solr_doc
|
121
174
|
solr_doc["title_si"] = sort_title
|
@@ -129,6 +182,10 @@ module Cul::Scv::Hydra::Solrizer
|
|
129
182
|
solr_doc["lib_format_sim"] = formats
|
130
183
|
solr_doc["lib_repo_sim"] = repositories
|
131
184
|
solr_doc["lib_shelf_sim"] = shelf_locators
|
185
|
+
solr_doc["lib_date_textual_ssm"] = textual_dates
|
186
|
+
solr_doc["lib_date_notes_ssm"] = date_notes
|
187
|
+
solr_doc["lib_non_date_notes_ssm"] = non_date_notes
|
188
|
+
solr_doc["lib_item_in_context_url_ssm"] = item_in_context_url
|
132
189
|
|
133
190
|
# Create convenient start and end date values based on one of the many possible originInfo/dateX elements.
|
134
191
|
possible_start_date_fields = ['origin_info_date_issued_ssm', 'origin_info_date_issued_start_ssm', 'origin_info_date_created_ssm', 'origin_info_date_created_start_ssm', 'origin_info_date_other_ssm', 'origin_info_date_other_start_ssm']
|
@@ -154,24 +211,25 @@ module Cul::Scv::Hydra::Solrizer
|
|
154
211
|
|
155
212
|
end_date = start_date if end_date.blank?
|
156
213
|
|
157
|
-
#solr_doc["lib_start_date_ss"] = start_date
|
158
|
-
#solr_doc["lib_end_date_ss"] = end_date
|
159
|
-
|
160
214
|
year_regex = /^(-?\d{1,4}).*/
|
161
215
|
|
162
216
|
start_year_match = start_date.match(year_regex)
|
163
217
|
start_year = start_year_match.captures[0] if start_year_match
|
164
218
|
start_year = zero_pad_year(start_year)
|
165
|
-
#solr_doc["lib_start_date_year_ssi"] = start_year if start_year
|
166
219
|
solr_doc["lib_start_date_year_itsi"] = start_year.to_i if start_year # TrieInt version for searches
|
167
220
|
|
168
221
|
end_year_match = end_date.match(year_regex)
|
169
222
|
end_year = end_year_match.captures[0] if end_year_match
|
170
223
|
end_year = zero_pad_year(end_year)
|
171
|
-
#solr_doc["lib_end_date_year_ssi"] = end_year if end_year
|
172
224
|
solr_doc["lib_end_date_year_itsi"] = end_year.to_i if end_year # TrieInt version for searches
|
173
225
|
|
174
226
|
solr_doc["lib_date_year_range_si"] = start_year + '-' + end_year if start_year
|
227
|
+
|
228
|
+
# When no textual date is available, fall back to other date data (if available)
|
229
|
+
if solr_doc["lib_date_textual_ssm"].blank?
|
230
|
+
|
231
|
+
solr_doc["lib_date_textual_ssm"] = date_range_to_textual_date(start_year.to_i, end_year.to_i)
|
232
|
+
end
|
175
233
|
end
|
176
234
|
|
177
235
|
solr_doc.each do |k, v|
|
@@ -11,7 +11,7 @@ class ValueMapper
|
|
11
11
|
config_path = File.join(File.dirname(__FILE__), "..", "..", "..", "config", "solr_value_maps.yml")
|
12
12
|
end
|
13
13
|
end
|
14
|
-
logger.info("ValueMapper: loading field value maps from #{File.expand_path(config_path)}")
|
14
|
+
#logger.info("ValueMapper: loading field value maps from #{File.expand_path(config_path)}")
|
15
15
|
YAML::load(File.open(config_path))
|
16
16
|
end
|
17
17
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cul_scv_hydra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Armintor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blacklight
|