gdor-indexer 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +13 -27
- data/Rakefile +1 -1
- data/gdor-indexer.gemspec +1 -1
- data/lib/gdor/indexer.rb +5 -4
- data/lib/gdor/indexer/solr_doc_builder.rb +1 -1
- data/lib/gdor/indexer/version.rb +1 -1
- data/spec/unit/indexer_spec.rb +14 -20
- data/spec/unit/mods_fields_spec.rb +0 -1
- data/spec/unit/mods_pub_fields_spec.rb +25 -25
- data/spec/unit/mods_subject_fields_spec.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3e6a69d961cda79c503df64ba9f6e96acd97a91
|
4
|
+
data.tar.gz: 4409fdd1c2379e5277a021d332e4be96178f8ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bb42c00986ea0fcbcaa2ef3765467da74badd29328f53e19b2337a8f0e643cc8cecbb0b95240a01abed0ad2c97984fc85bf7e8aa09ee20735d95b13c512de78
|
7
|
+
data.tar.gz: f72607a1e4eba439825b9bb2a649271483b329b60d91aa4deb4a902074bc8b78c70ad28af026dd139d92533bcbc0f756f94330fe776758dc1d68cecd28023e0e
|
data/.rubocop_todo.yml
CHANGED
@@ -2,7 +2,7 @@ require: rubocop-rspec
|
|
2
2
|
|
3
3
|
# This configuration was generated by
|
4
4
|
# `rubocop --auto-gen-config`
|
5
|
-
# on 2016-
|
5
|
+
# on 2016-09-22 06:51:42 -0700 using RuboCop version 0.43.0.
|
6
6
|
# The point is for the user to remove these configuration records
|
7
7
|
# one by one as the offenses are removed from the code base.
|
8
8
|
# Note that changes in the inspected code, or installation of new
|
@@ -20,7 +20,7 @@ Metrics/AbcSize:
|
|
20
20
|
# Offense count: 1
|
21
21
|
# Configuration parameters: CountComments.
|
22
22
|
Metrics/ClassLength:
|
23
|
-
Max:
|
23
|
+
Max: 240
|
24
24
|
|
25
25
|
# Offense count: 5
|
26
26
|
Metrics/CyclomaticComplexity:
|
@@ -32,7 +32,7 @@ Metrics/CyclomaticComplexity:
|
|
32
32
|
Metrics/LineLength:
|
33
33
|
Max: 258
|
34
34
|
|
35
|
-
# Offense count:
|
35
|
+
# Offense count: 14
|
36
36
|
# Configuration parameters: CountComments.
|
37
37
|
Metrics/MethodLength:
|
38
38
|
Max: 43
|
@@ -70,7 +70,7 @@ RSpec/FilePath:
|
|
70
70
|
- 'spec/unit/solr_doc_builder_spec.rb'
|
71
71
|
- 'spec/unit/solr_doc_hash_spec.rb'
|
72
72
|
|
73
|
-
# Offense count:
|
73
|
+
# Offense count: 158
|
74
74
|
# Configuration parameters: AssignmentOnly.
|
75
75
|
RSpec/InstanceVariable:
|
76
76
|
Exclude:
|
@@ -119,14 +119,6 @@ RSpec/VerifiedDoubles:
|
|
119
119
|
Exclude:
|
120
120
|
- 'spec/unit/indexer_spec.rb'
|
121
121
|
|
122
|
-
# Offense count: 7
|
123
|
-
# Cop supports --auto-correct.
|
124
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
125
|
-
# SupportedStyles: braces, no_braces, context_dependent
|
126
|
-
Style/BracesAroundHashParameters:
|
127
|
-
Exclude:
|
128
|
-
- 'spec/unit/indexer_spec.rb'
|
129
|
-
|
130
122
|
# Offense count: 4
|
131
123
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
132
124
|
# SupportedStyles: nested, compact
|
@@ -137,20 +129,14 @@ Style/ClassAndModuleChildren:
|
|
137
129
|
- 'lib/gdor/indexer/solr_doc_builder.rb'
|
138
130
|
- 'lib/gdor/indexer/solr_doc_hash.rb'
|
139
131
|
|
140
|
-
# Offense count: 22
|
141
|
-
# Cop supports --auto-correct.
|
142
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
143
|
-
# SupportedStyles: aligned, indented
|
144
|
-
Style/MultilineOperationIndentation:
|
145
|
-
Exclude:
|
146
|
-
- 'Rakefile'
|
147
|
-
- 'spec/unit/mods_pub_fields_spec.rb'
|
148
|
-
|
149
132
|
# Offense count: 2
|
150
|
-
#
|
151
|
-
|
152
|
-
# SupportedStyles: slashes, percent_r, mixed
|
153
|
-
Style/RegexpLiteral:
|
133
|
+
# Configuration parameters: MinBodyLength.
|
134
|
+
Style/GuardClause:
|
154
135
|
Exclude:
|
155
|
-
- '
|
156
|
-
|
136
|
+
- 'lib/gdor/indexer.rb'
|
137
|
+
|
138
|
+
# Offense count: 4
|
139
|
+
# Configuration parameters: SupportedStyles.
|
140
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
141
|
+
Style/VariableNumber:
|
142
|
+
Enabled: false
|
data/Rakefile
CHANGED
@@ -46,7 +46,7 @@ begin
|
|
46
46
|
|
47
47
|
YARD::Rake::YardocTask.new(:doc) do |yt|
|
48
48
|
yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
|
49
|
-
|
49
|
+
[File.join(project_root, 'README.rdoc')]
|
50
50
|
yt.options = ['--output-dir', doc_dest_dir, '--readme', 'README.rdoc', '--title', 'Gryphondor Indexer Documentation']
|
51
51
|
end
|
52
52
|
rescue LoadError
|
data/gdor-indexer.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_dependency 'harvestdor-indexer'
|
21
|
-
spec.add_dependency 'stanford-mods', '~> 2.2.1'
|
21
|
+
spec.add_dependency 'stanford-mods', '~> 2.2', '>= 2.2.1'
|
22
22
|
spec.add_dependency 'nokogiri'
|
23
23
|
spec.add_dependency 'rsolr'
|
24
24
|
spec.add_dependency 'activesupport'
|
data/lib/gdor/indexer.rb
CHANGED
@@ -128,9 +128,10 @@ module GDor
|
|
128
128
|
raise e
|
129
129
|
end
|
130
130
|
|
131
|
-
#
|
132
|
-
# NOTE: don't forget to send commit to Solr, either once at end (already in harvest_and_index), or for each add, or ...
|
131
|
+
# Create Solr doc for the druid and add it to Solr, unless it is on the blacklist.
|
133
132
|
# @param [Harvestdor::Indexer::Resource] resource an item record (a member of a collection)
|
133
|
+
# @return [Hash]
|
134
|
+
# @note don't forget to send commit to Solr, either once at end (already in harvest_and_index), or for each add, or ...
|
134
135
|
def item_solr_document(resource)
|
135
136
|
sdb = GDor::Indexer::SolrDocBuilder.new(resource, logger)
|
136
137
|
|
@@ -154,7 +155,7 @@ module GDor
|
|
154
155
|
end
|
155
156
|
|
156
157
|
# Create Solr document for the collection druid suitable for SearchWorks
|
157
|
-
#
|
158
|
+
# and write the result to the SearchWorks Solr Index
|
158
159
|
# @param [Harvestdor::Indexer::Resource] resource a collection record
|
159
160
|
# @return [Hash]
|
160
161
|
def collection_solr_document(resource)
|
@@ -179,7 +180,7 @@ module GDor
|
|
179
180
|
doc_hash.to_h
|
180
181
|
end
|
181
182
|
|
182
|
-
#
|
183
|
+
# Add collection level data to this solr doc and/or cache collection level information
|
183
184
|
# @param [Hash] doc_hash representing the Solr document (for an item)
|
184
185
|
# @param [Array<Harvestdor::Indexer::Resource>] collections the collections the item is a member of
|
185
186
|
def add_coll_info(doc_hash, collections)
|
@@ -43,7 +43,7 @@ class GDor::Indexer::SolrDocBuilder
|
|
43
43
|
# if not found, we look for
|
44
44
|
# identityMetadata/otherId[@name='barcode']
|
45
45
|
# if found, we look for catkey in MODS
|
46
|
-
# mods/recordInfo/recordIdentifier[@source="SIRSI"
|
46
|
+
# mods/recordInfo/recordIdentifier[@source="SIRSI"]
|
47
47
|
# and if found, remove the leading a
|
48
48
|
# otherwise, nil
|
49
49
|
def catkey
|
data/lib/gdor/indexer/version.rb
CHANGED
data/spec/unit/indexer_spec.rb
CHANGED
@@ -228,12 +228,12 @@ describe GDor::Indexer do
|
|
228
228
|
expect(doc_hash).to include format_main_ssim: 'Archive/Manuscript'
|
229
229
|
end
|
230
230
|
it 'other values present' do
|
231
|
-
allow_any_instance_of(GDor::Indexer::SolrDocBuilder).to receive(:doc_hash).and_return(GDor::Indexer::SolrDocHash.new(
|
231
|
+
allow_any_instance_of(GDor::Indexer::SolrDocBuilder).to receive(:doc_hash).and_return(GDor::Indexer::SolrDocHash.new(format_main_ssim: %w(Image Video)))
|
232
232
|
doc_hash = @indexer.collection_solr_document collection
|
233
233
|
expect(doc_hash).to include format_main_ssim: ['Image', 'Video', 'Archive/Manuscript']
|
234
234
|
end
|
235
235
|
it 'already has values Archive/Manuscript' do
|
236
|
-
allow_any_instance_of(GDor::Indexer::SolrDocBuilder).to receive(:doc_hash).and_return(GDor::Indexer::SolrDocHash.new(
|
236
|
+
allow_any_instance_of(GDor::Indexer::SolrDocBuilder).to receive(:doc_hash).and_return(GDor::Indexer::SolrDocHash.new(format_main_ssim: 'Archive/Manuscript'))
|
237
237
|
doc_hash = @indexer.collection_solr_document collection
|
238
238
|
expect(doc_hash).to include format_main_ssim: ['Archive/Manuscript']
|
239
239
|
end
|
@@ -246,9 +246,7 @@ describe GDor::Indexer do
|
|
246
246
|
end # index_coll_obj_per_config
|
247
247
|
|
248
248
|
context '#add_coll_info and supporting methods' do
|
249
|
-
|
250
|
-
@coll_druids_array = [collection]
|
251
|
-
end
|
249
|
+
let(:coll_druids_array) { [collection] }
|
252
250
|
let(:doc_hash) { GDor::Indexer::SolrDocHash.new({}) }
|
253
251
|
|
254
252
|
it 'adds no collection field values to doc_hash if there are none' do
|
@@ -260,7 +258,7 @@ describe GDor::Indexer do
|
|
260
258
|
|
261
259
|
context 'collection field' do
|
262
260
|
it 'is added field to doc hash' do
|
263
|
-
@indexer.add_coll_info(doc_hash,
|
261
|
+
@indexer.add_coll_info(doc_hash, coll_druids_array)
|
264
262
|
expect(doc_hash[:collection]).to match_array [@coll_druid_from_test_config]
|
265
263
|
end
|
266
264
|
it 'adds two values to doc_hash when object belongs to two collections' do
|
@@ -293,18 +291,18 @@ describe GDor::Indexer do
|
|
293
291
|
end
|
294
292
|
it 'gets single item display_type for single collection (and no dups)' do
|
295
293
|
allow(@indexer).to receive(:identity_md_obj_label)
|
296
|
-
doc_hash = GDor::Indexer::SolrDocHash.new(
|
297
|
-
@indexer.add_coll_info(doc_hash,
|
298
|
-
doc_hash = GDor::Indexer::SolrDocHash.new(
|
299
|
-
@indexer.add_coll_info(doc_hash,
|
294
|
+
doc_hash = GDor::Indexer::SolrDocHash.new(display_type: 'image')
|
295
|
+
@indexer.add_coll_info(doc_hash, coll_druids_array)
|
296
|
+
doc_hash = GDor::Indexer::SolrDocHash.new(display_type: 'image')
|
297
|
+
@indexer.add_coll_info(doc_hash, coll_druids_array)
|
300
298
|
expect(@indexer.coll_display_types_from_items(collection)).to match_array ['image']
|
301
299
|
end
|
302
300
|
it 'gets multiple formats from multiple items for single collection' do
|
303
301
|
allow(@indexer).to receive(:identity_md_obj_label)
|
304
|
-
doc_hash = GDor::Indexer::SolrDocHash.new(
|
305
|
-
@indexer.add_coll_info(doc_hash,
|
306
|
-
doc_hash = GDor::Indexer::SolrDocHash.new(
|
307
|
-
@indexer.add_coll_info(doc_hash,
|
302
|
+
doc_hash = GDor::Indexer::SolrDocHash.new(display_type: 'image')
|
303
|
+
@indexer.add_coll_info(doc_hash, coll_druids_array)
|
304
|
+
doc_hash = GDor::Indexer::SolrDocHash.new(display_type: 'file')
|
305
|
+
@indexer.add_coll_info(doc_hash, coll_druids_array)
|
308
306
|
expect(@indexer.coll_display_types_from_items(collection)).to match_array %w(image file)
|
309
307
|
end
|
310
308
|
end # coll_display_types_from_items
|
@@ -360,7 +358,7 @@ describe GDor::Indexer do
|
|
360
358
|
end
|
361
359
|
|
362
360
|
it 'email includes reference to full log' do
|
363
|
-
expect(subject).to match(
|
361
|
+
expect(subject).to match(%r{full log is at gdor_indexer/shared/spec/test_logs/testcoll\.log})
|
364
362
|
end
|
365
363
|
end
|
366
364
|
|
@@ -375,7 +373,6 @@ describe GDor::Indexer do
|
|
375
373
|
expect(@indexer).to receive(:send_email) do |_to, opts|
|
376
374
|
expect(opts[:subject]).to match(/is finished/)
|
377
375
|
end
|
378
|
-
|
379
376
|
@indexer.email_results
|
380
377
|
end
|
381
378
|
|
@@ -383,7 +380,6 @@ describe GDor::Indexer do
|
|
383
380
|
expect(@indexer).to receive(:send_email) do |to, _opts|
|
384
381
|
expect(to).to eq @indexer.config.notification
|
385
382
|
end
|
386
|
-
|
387
383
|
@indexer.email_results
|
388
384
|
end
|
389
385
|
|
@@ -391,7 +387,6 @@ describe GDor::Indexer do
|
|
391
387
|
expect(@indexer).to receive(:send_email) do |_to, opts|
|
392
388
|
expect(opts[:body]).to eq 'Report Body'
|
393
389
|
end
|
394
|
-
|
395
390
|
@indexer.email_results
|
396
391
|
end
|
397
392
|
end
|
@@ -410,7 +405,7 @@ describe GDor::Indexer do
|
|
410
405
|
expect(mail.from).to match_array ['rspec']
|
411
406
|
expect(mail.body).to eq 'Body'
|
412
407
|
end
|
413
|
-
@indexer.send_email 'notification-list@example.com',
|
408
|
+
@indexer.send_email 'notification-list@example.com', from: 'rspec', subject: 'Subject', body: 'Body'
|
414
409
|
end
|
415
410
|
end
|
416
411
|
|
@@ -422,7 +417,6 @@ describe GDor::Indexer do
|
|
422
417
|
it 'can be set as an option' do
|
423
418
|
solr_client = double
|
424
419
|
@indexer = described_class.new(solr_client: solr_client)
|
425
|
-
|
426
420
|
expect(@indexer.solr_client).to eq solr_client
|
427
421
|
end
|
428
422
|
end
|
@@ -23,7 +23,7 @@ describe GDor::Indexer::ModsFields do
|
|
23
23
|
RSpec.shared_examples 'expected (dateIssued)' do |solr_field_sym, mods_field_val, exp_val|
|
24
24
|
it "#{exp_val} for #{mods_field_val}" do
|
25
25
|
m = mods_origin_info_start_str +
|
26
|
-
|
26
|
+
"<dateIssued>#{mods_field_val}</dateIssued>" +
|
27
27
|
mods_origin_info_end_str
|
28
28
|
sdb = sdb_for_mods(m)
|
29
29
|
expect(sdb.doc_hash_from_mods[solr_field_sym]).to eq exp_val
|
@@ -62,14 +62,14 @@ describe GDor::Indexer::ModsFields do
|
|
62
62
|
end
|
63
63
|
it 'includes approx dates' do
|
64
64
|
m = mods_origin_info_start_str +
|
65
|
-
|
65
|
+
"<dateIssued qualifier='approximate'>1945</dateIssued>" +
|
66
66
|
mods_origin_info_end_str
|
67
67
|
sdb = sdb_for_mods(m)
|
68
68
|
expect(sdb.doc_hash_from_mods[:pub_year_isi]).to eq 1945
|
69
69
|
end
|
70
70
|
it 'will use dateCreated' do
|
71
71
|
m = mods_origin_info_start_str +
|
72
|
-
|
72
|
+
"<dateCreated>1904</dateCreated>" +
|
73
73
|
mods_origin_info_end_str
|
74
74
|
sdb = sdb_for_mods(m)
|
75
75
|
expect(sdb.doc_hash_from_mods[:pub_year_isi]).to eq 1904
|
@@ -85,14 +85,14 @@ describe GDor::Indexer::ModsFields do
|
|
85
85
|
end
|
86
86
|
it 'includes approx dates' do
|
87
87
|
m = mods_origin_info_start_str +
|
88
|
-
|
88
|
+
"<dateIssued qualifier='approximate'>1945</dateIssued>" +
|
89
89
|
mods_origin_info_end_str
|
90
90
|
sdb = sdb_for_mods(m)
|
91
91
|
expect(sdb.doc_hash_from_mods[:pub_date_sort]).to eq('1945')
|
92
92
|
end
|
93
93
|
it 'takes single dateCreated' do
|
94
94
|
m = mods_origin_info_start_str +
|
95
|
-
|
95
|
+
"<dateCreated>1904</dateCreated>" +
|
96
96
|
mods_origin_info_end_str
|
97
97
|
sdb = sdb_for_mods(m)
|
98
98
|
expect(sdb.doc_hash_from_mods[:pub_date_sort]).to eq('1904')
|
@@ -117,16 +117,16 @@ describe GDor::Indexer::ModsFields do
|
|
117
117
|
context 'pub_year_no_approx_isi' do
|
118
118
|
it 'does not include approx dates' do
|
119
119
|
m = mods_origin_info_start_str +
|
120
|
-
|
121
|
-
|
120
|
+
"<dateIssued qualifier='approximate'>1945</dateIssued>" +
|
121
|
+
mods_origin_info_end_str
|
122
122
|
sdb = sdb_for_mods(m)
|
123
123
|
expect(sdb.doc_hash_from_mods[:pub_year_no_approx_isi]).to eq nil
|
124
124
|
end
|
125
125
|
it 'calls Stanford::Mods::Record instance pub_year_int(true)' do
|
126
126
|
mods = mods_origin_info_start_str +
|
127
|
-
|
128
|
-
|
129
|
-
|
127
|
+
"<dateIssued qualifier=\"approximate\">1500</dateIssued>
|
128
|
+
<dateIssued>2000</dateIssued>" +
|
129
|
+
mods_origin_info_end_str
|
130
130
|
sdb = sdb_for_mods(mods)
|
131
131
|
expect(sdb.smods_rec).to receive(:pub_year_int).with(true).and_call_original
|
132
132
|
allow(sdb.smods_rec).to receive(:pub_year_int).with(false) # for other flavor
|
@@ -134,7 +134,7 @@ describe GDor::Indexer::ModsFields do
|
|
134
134
|
end
|
135
135
|
it 'will use dateCreated' do
|
136
136
|
m = mods_origin_info_start_str +
|
137
|
-
|
137
|
+
"<dateCreated>1904</dateCreated>" +
|
138
138
|
mods_origin_info_end_str
|
139
139
|
sdb = sdb_for_mods(m)
|
140
140
|
expect(sdb.doc_hash_from_mods[:pub_year_no_approx_isi]).to eq 1904
|
@@ -146,16 +146,16 @@ describe GDor::Indexer::ModsFields do
|
|
146
146
|
context 'pub_year_w_approx_isi' do
|
147
147
|
it 'includes approx dates' do
|
148
148
|
m = mods_origin_info_start_str +
|
149
|
-
|
150
|
-
|
149
|
+
"<dateIssued qualifier='approximate'>1945</dateIssued>" +
|
150
|
+
mods_origin_info_end_str
|
151
151
|
sdb = sdb_for_mods(m)
|
152
152
|
expect(sdb.doc_hash_from_mods[:pub_year_w_approx_isi]).to eq 1945
|
153
153
|
end
|
154
154
|
it 'calls Stanford::Mods::Record instance pub_year_int(false)' do
|
155
155
|
mods = mods_origin_info_start_str +
|
156
|
-
|
157
|
-
|
158
|
-
|
156
|
+
"<dateIssued qualifier=\"approximate\">1500</dateIssued>
|
157
|
+
<dateIssued>2000</dateIssued>" +
|
158
|
+
mods_origin_info_end_str
|
159
159
|
sdb = sdb_for_mods(mods)
|
160
160
|
expect(sdb.smods_rec).to receive(:pub_year_int).with(false).and_call_original
|
161
161
|
allow(sdb.smods_rec).to receive(:pub_year_int).with(true) # for other flavor
|
@@ -163,7 +163,7 @@ describe GDor::Indexer::ModsFields do
|
|
163
163
|
end
|
164
164
|
it 'will use dateCreated' do
|
165
165
|
m = mods_origin_info_start_str +
|
166
|
-
|
166
|
+
"<dateCreated>1904</dateCreated>" +
|
167
167
|
mods_origin_info_end_str
|
168
168
|
sdb = sdb_for_mods(m)
|
169
169
|
expect(sdb.doc_hash_from_mods[:pub_year_w_approx_isi]).to eq 1904
|
@@ -183,14 +183,14 @@ describe GDor::Indexer::ModsFields do
|
|
183
183
|
end
|
184
184
|
it 'includes approx dates' do
|
185
185
|
m = mods_origin_info_start_str +
|
186
|
-
|
187
|
-
|
186
|
+
"<dateIssued qualifier='approximate'>1945</dateIssued>" +
|
187
|
+
mods_origin_info_end_str
|
188
188
|
sdb = sdb_for_mods(m)
|
189
189
|
expect(sdb.doc_hash_from_mods[:pub_year_tisim]).to eq 1945
|
190
190
|
end
|
191
191
|
it 'will use dateCreated' do
|
192
192
|
m = mods_origin_info_start_str +
|
193
|
-
|
193
|
+
"<dateCreated>1904</dateCreated>" +
|
194
194
|
mods_origin_info_end_str
|
195
195
|
sdb = sdb_for_mods(m)
|
196
196
|
expect(sdb.doc_hash_from_mods[:pub_year_tisim]).to eq 1904
|
@@ -208,8 +208,8 @@ describe GDor::Indexer::ModsFields do
|
|
208
208
|
context 'creation_year_isi' do
|
209
209
|
it 'creation_year_isi calls Stanford::Mods::Record year_int for dateCreated elements' do
|
210
210
|
m = mods_origin_info_start_str +
|
211
|
-
|
212
|
-
|
211
|
+
"<dateCreated qualifier='approximate'>1500</dateCreated>
|
212
|
+
<dateIssued qualifier='approximate'>2000</dateIssued>" +
|
213
213
|
mods_origin_info_end_str
|
214
214
|
sdb = sdb_for_mods(m)
|
215
215
|
expect(sdb.smods_rec).to receive(:year_int).at_least(2).times.and_call_original
|
@@ -218,7 +218,7 @@ describe GDor::Indexer::ModsFields do
|
|
218
218
|
RSpec.shared_examples 'expected (dateCreated)' do |mods_field_val, exp_val|
|
219
219
|
it "#{exp_val} for #{mods_field_val}" do
|
220
220
|
m = mods_origin_info_start_str +
|
221
|
-
|
221
|
+
"<dateCreated>#{mods_field_val}</dateCreated>" +
|
222
222
|
mods_origin_info_end_str
|
223
223
|
sdb = sdb_for_mods(m)
|
224
224
|
expect(sdb.doc_hash_from_mods[:creation_year_isi]).to eq exp_val
|
@@ -248,8 +248,8 @@ describe GDor::Indexer::ModsFields do
|
|
248
248
|
context 'publication_year_isi' do
|
249
249
|
it 'publication_year_isi calls Stanford::Mods::Record year_int for dateIssued elements' do
|
250
250
|
m = mods_origin_info_start_str +
|
251
|
-
|
252
|
-
|
251
|
+
"<dateCreated qualifier='approximate'>1500</dateCreated>
|
252
|
+
<dateIssued qualifier='approximate'>2000</dateIssued>" +
|
253
253
|
mods_origin_info_end_str
|
254
254
|
sdb = sdb_for_mods(m)
|
255
255
|
expect(sdb.smods_rec).to receive(:year_int).at_least(2).times.and_call_original
|
@@ -105,7 +105,7 @@ describe GDor::Indexer::ModsFields do
|
|
105
105
|
it "logs an info message when it encounters a geographicCode encoding it doesn't translate" do
|
106
106
|
m = "<mods #{ns_decl}><subject><geographicCode authority='iso3166'>ca</geographicCode></subject></mods>"
|
107
107
|
sdb = sdb_for_mods(m)
|
108
|
-
expect(sdb.smods_rec.sw_logger).to receive(:info).with(
|
108
|
+
expect(sdb.smods_rec.sw_logger).to receive(:info).with(%r{#{fake_druid} has subject geographicCode element with untranslated encoding \(iso3166\): <geographicCode authority=.*>ca</geographicCode>}).at_least(1).times
|
109
109
|
sdb.doc_hash_from_mods
|
110
110
|
end
|
111
111
|
end # geographic_search
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gdor-indexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: harvestdor-indexer
|
@@ -31,6 +31,9 @@ dependencies:
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '2.2'
|
36
|
+
- - ">="
|
34
37
|
- !ruby/object:Gem::Version
|
35
38
|
version: 2.2.1
|
36
39
|
type: :runtime
|
@@ -38,6 +41,9 @@ dependencies:
|
|
38
41
|
version_requirements: !ruby/object:Gem::Requirement
|
39
42
|
requirements:
|
40
43
|
- - "~>"
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.2'
|
46
|
+
- - ">="
|
41
47
|
- !ruby/object:Gem::Version
|
42
48
|
version: 2.2.1
|
43
49
|
- !ruby/object:Gem::Dependency
|