traject 2.3.4 → 3.0.0.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +16 -9
- data/CHANGES.md +74 -1
- data/Gemfile +2 -1
- data/README.md +104 -53
- data/Rakefile +8 -1
- data/doc/indexing_rules.md +79 -63
- data/doc/programmatic_use.md +218 -0
- data/doc/settings.md +28 -1
- data/doc/xml.md +134 -0
- data/lib/traject.rb +5 -0
- data/lib/traject/array_writer.rb +34 -0
- data/lib/traject/command_line.rb +18 -22
- data/lib/traject/debug_writer.rb +2 -5
- data/lib/traject/experimental_nokogiri_streaming_reader.rb +276 -0
- data/lib/traject/hashie/indifferent_access_fix.rb +25 -0
- data/lib/traject/indexer.rb +321 -92
- data/lib/traject/indexer/context.rb +39 -13
- data/lib/traject/indexer/marc_indexer.rb +30 -0
- data/lib/traject/indexer/nokogiri_indexer.rb +30 -0
- data/lib/traject/indexer/settings.rb +36 -53
- data/lib/traject/indexer/step.rb +27 -33
- data/lib/traject/macros/marc21.rb +37 -12
- data/lib/traject/macros/nokogiri_macros.rb +43 -0
- data/lib/traject/macros/transformation.rb +162 -0
- data/lib/traject/marc_extractor.rb +2 -0
- data/lib/traject/ndj_reader.rb +1 -1
- data/lib/traject/nokogiri_reader.rb +179 -0
- data/lib/traject/oai_pmh_nokogiri_reader.rb +159 -0
- data/lib/traject/solr_json_writer.rb +19 -12
- data/lib/traject/thread_pool.rb +13 -0
- data/lib/traject/util.rb +14 -2
- data/lib/traject/version.rb +1 -1
- data/test/debug_writer_test.rb +3 -3
- data/test/delimited_writer_test.rb +3 -3
- data/test/experimental_nokogiri_streaming_reader_test.rb +169 -0
- data/test/indexer/context_test.rb +23 -13
- data/test/indexer/error_handler_test.rb +59 -0
- data/test/indexer/macros/macros_marc21_semantics_test.rb +46 -46
- data/test/indexer/macros/marc21/extract_all_marc_values_test.rb +1 -1
- data/test/indexer/macros/marc21/extract_marc_test.rb +19 -9
- data/test/indexer/macros/marc21/serialize_marc_test.rb +4 -4
- data/test/indexer/macros/to_field_test.rb +2 -2
- data/test/indexer/macros/transformation_test.rb +177 -0
- data/test/indexer/map_record_test.rb +2 -3
- data/test/indexer/nokogiri_indexer_test.rb +103 -0
- data/test/indexer/process_record_test.rb +55 -0
- data/test/indexer/process_with_test.rb +148 -0
- data/test/indexer/read_write_test.rb +52 -2
- data/test/indexer/settings_test.rb +34 -24
- data/test/indexer/to_field_test.rb +27 -2
- data/test/marc_extractor_test.rb +7 -7
- data/test/marc_reader_test.rb +4 -4
- data/test/nokogiri_reader_test.rb +158 -0
- data/test/oai_pmh_nokogiri_reader_test.rb +23 -0
- data/test/solr_json_writer_test.rb +24 -28
- data/test/test_helper.rb +8 -2
- data/test/test_support/namespace-test.xml +7 -0
- data/test/test_support/nokogiri_demo_config.rb +17 -0
- data/test/test_support/oai-pmh-one-record-2.xml +24 -0
- data/test/test_support/oai-pmh-one-record-first.xml +24 -0
- data/test/test_support/sample-oai-no-namespace.xml +197 -0
- data/test/test_support/sample-oai-pmh.xml +197 -0
- data/test/thread_pool_test.rb +38 -0
- data/test/translation_map_test.rb +3 -3
- data/test/translation_maps/ruby_map.rb +2 -1
- data/test/translation_maps/yaml_map.yaml +2 -1
- data/traject.gemspec +4 -11
- metadata +92 -6
@@ -22,16 +22,16 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "oclcnum" do
|
25
|
-
@indexer.
|
25
|
+
@indexer.configure do
|
26
26
|
to_field "oclcnum", oclcnum
|
27
27
|
end
|
28
28
|
output = @indexer.map_record(@record)
|
29
29
|
|
30
30
|
assert_equal %w{47971712}, output["oclcnum"]
|
31
|
-
|
31
|
+
|
32
32
|
assert_equal({}, @indexer.map_record(empty_record))
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "deals with all prefixed OCLC nunbers" do
|
36
36
|
@record.append(MARC::DataField.new('035', ' ', ' ', ['a', '(OCoLC)ocm111111111']))
|
37
37
|
@record.append(MARC::DataField.new('035', ' ', ' ', ['a', '(OCoLC)222222222']))
|
@@ -40,21 +40,21 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
40
40
|
@record.append(MARC::DataField.new('035', ' ', ' ', ['a', '(OCoLC)ocn555555555']))
|
41
41
|
@record.append(MARC::DataField.new('035', ' ', ' ', ['a', '(OCoLC)on666666666']))
|
42
42
|
@record.append(MARC::DataField.new('035', ' ', ' ', ['a', '777777777'])) # not OCLC number
|
43
|
-
|
44
|
-
@indexer.
|
43
|
+
|
44
|
+
@indexer.configure do
|
45
45
|
to_field "oclcnum", oclcnum
|
46
46
|
end
|
47
47
|
output = @indexer.map_record(@record)
|
48
48
|
|
49
49
|
assert_equal %w{47971712 111111111 222222222 333333333 444444444 555555555 666666666}, output["oclcnum"]
|
50
50
|
end
|
51
|
-
|
52
|
-
|
51
|
+
|
52
|
+
|
53
53
|
|
54
54
|
it "#marc_series_facet" do
|
55
55
|
@record = MARC::Reader.new(support_file_path "louis_armstrong.marc").to_a.first
|
56
56
|
|
57
|
-
@indexer.
|
57
|
+
@indexer.configure do
|
58
58
|
to_field "series_facet", marc_series_facet
|
59
59
|
end
|
60
60
|
output = @indexer.map_record(@record)
|
@@ -62,14 +62,14 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
62
62
|
# trims punctuation too
|
63
63
|
assert_equal ["Big bands"], output["series_facet"]
|
64
64
|
assert_equal({}, @indexer.map_record(empty_record))
|
65
|
-
|
65
|
+
|
66
66
|
end
|
67
67
|
|
68
68
|
describe "marc_sortable_author" do
|
69
69
|
# these probably should be taking only certain subfields, but we're copying
|
70
70
|
# from SolrMarc that didn't do so either and nobody noticed, so not bothering for now.
|
71
71
|
before do
|
72
|
-
@indexer.
|
72
|
+
@indexer.configure do
|
73
73
|
to_field "author_sort", marc_sortable_author
|
74
74
|
end
|
75
75
|
end
|
@@ -78,7 +78,7 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
78
78
|
|
79
79
|
assert_equal ["Herman, Edward S. Manufacturing consent the political economy of the mass media Edward S. Herman and Noam Chomsky ; with a new introduction by the authors"], output["author_sort"]
|
80
80
|
assert_equal [""], @indexer.map_record(empty_record)['author_sort']
|
81
|
-
|
81
|
+
|
82
82
|
end
|
83
83
|
it "respects non-filing" do
|
84
84
|
@record = MARC::Reader.new(support_file_path "the_business_ren.marc").to_a.first
|
@@ -87,19 +87,19 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
87
87
|
|
88
88
|
assert_equal ["Business renaissance quarterly [electronic resource]."], output["author_sort"]
|
89
89
|
assert_equal [""], @indexer.map_record(empty_record)['author_sort']
|
90
|
-
|
90
|
+
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
94
|
describe "marc_sortable_title" do
|
95
95
|
before do
|
96
|
-
@indexer.
|
96
|
+
@indexer.configure { to_field "title_sort", marc_sortable_title }
|
97
97
|
end
|
98
98
|
it "works" do
|
99
99
|
output = @indexer.map_record(@record)
|
100
100
|
assert_equal ["Manufacturing consent : the political economy of the mass media"], output["title_sort"]
|
101
101
|
assert_equal({}, @indexer.map_record(empty_record))
|
102
|
-
|
102
|
+
|
103
103
|
end
|
104
104
|
it "respects non-filing" do
|
105
105
|
@record = MARC::Reader.new(support_file_path "the_business_ren.marc").to_a.first
|
@@ -116,7 +116,7 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
116
116
|
|
117
117
|
describe "marc_languages" do
|
118
118
|
before do
|
119
|
-
@indexer.
|
119
|
+
@indexer.configure {to_field "languages", marc_languages() }
|
120
120
|
end
|
121
121
|
|
122
122
|
it "unpacks packed 041a and translates" do
|
@@ -125,14 +125,14 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
125
125
|
|
126
126
|
assert_equal ["English", "French", "German", "Italian", "Spanish", "Russian"], output["languages"]
|
127
127
|
assert_equal({}, @indexer.map_record(empty_record))
|
128
|
-
|
128
|
+
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
132
|
describe "marc_instrumentation_humanized" do
|
133
133
|
before do
|
134
134
|
@record = MARC::Reader.new(support_file_path "musical_cage.marc").to_a.first
|
135
|
-
@indexer.
|
135
|
+
@indexer.configure {to_field "instrumentation", marc_instrumentation_humanized }
|
136
136
|
end
|
137
137
|
|
138
138
|
it "translates, de-duping" do
|
@@ -140,14 +140,14 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
140
140
|
|
141
141
|
assert_equal ["Larger ensemble, Unspecified", "Piano", "Soprano voice", "Tenor voice", "Violin", "Larger ensemble, Ethnic", "Guitar", "Voices, Unspecified"], output["instrumentation"]
|
142
142
|
assert_equal({}, @indexer.map_record(empty_record))
|
143
|
-
|
143
|
+
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
describe "marc_instrument_codes_normalized" do
|
148
148
|
before do
|
149
149
|
@record = MARC::Reader.new(support_file_path "musical_cage.marc").to_a.first
|
150
|
-
@indexer.
|
150
|
+
@indexer.configure {to_field "instrument_codes", marc_instrument_codes_normalized }
|
151
151
|
end
|
152
152
|
it "normalizes, de-duping" do
|
153
153
|
output = @indexer.map_record(@record)
|
@@ -161,27 +161,27 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
161
161
|
|
162
162
|
assert_equal ["bb01", "bb01.s", "bb", "bb.s", "oe"], output["instrument_codes"]
|
163
163
|
assert_equal({}, @indexer.map_record(empty_record))
|
164
|
-
|
164
|
+
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
168
|
describe "publication_date" do
|
169
169
|
# there are way too many edge cases for us to test em all, but we'll test some of em.
|
170
|
-
|
170
|
+
|
171
171
|
it "works when there's no date information" do
|
172
172
|
assert_nil Marc21Semantics.publication_date(empty_record)
|
173
173
|
end
|
174
|
-
|
174
|
+
|
175
175
|
it "uses macro correctly with no date info" do
|
176
|
-
@indexer.
|
176
|
+
@indexer.configure {to_field "date", marc_publication_date }
|
177
177
|
assert_equal({}, @indexer.map_record(empty_record))
|
178
178
|
end
|
179
|
-
|
180
|
-
|
179
|
+
|
180
|
+
|
181
181
|
it "pulls out 008 date_type s" do
|
182
182
|
@record = MARC::Reader.new(support_file_path "manufacturing_consent.marc").to_a.first
|
183
183
|
assert_equal 2002, Marc21Semantics.publication_date(@record)
|
184
|
-
|
184
|
+
|
185
185
|
end
|
186
186
|
it "uses start date for date_type c continuing resource" do
|
187
187
|
@record = MARC::Reader.new(support_file_path "the_business_ren.marc").to_a.first
|
@@ -221,14 +221,14 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
221
221
|
|
222
222
|
describe "marc_lcc_to_broad_category" do
|
223
223
|
before do
|
224
|
-
@indexer.
|
224
|
+
@indexer.configure { to_field "discipline_facet", marc_lcc_to_broad_category }
|
225
225
|
end
|
226
226
|
it "maps a simple example" do
|
227
227
|
@record = MARC::Reader.new(support_file_path "manufacturing_consent.marc").to_a.first
|
228
228
|
output = @indexer.map_record(@record)
|
229
229
|
|
230
230
|
assert_equal ["Language & Literature"], output["discipline_facet"]
|
231
|
-
|
231
|
+
|
232
232
|
end
|
233
233
|
it "maps to default" do
|
234
234
|
@record = MARC::Reader.new(support_file_path "musical_cage.marc").to_a.first
|
@@ -238,14 +238,14 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
238
238
|
end
|
239
239
|
|
240
240
|
it "maps to nothing if none and no default" do
|
241
|
-
@indexer.
|
241
|
+
@indexer.configure { to_field "discipline_no_default", marc_lcc_to_broad_category(:default => nil) }
|
242
242
|
@record = MARC::Reader.new(support_file_path "musical_cage.marc").to_a.first
|
243
243
|
output = @indexer.map_record(@record)
|
244
244
|
|
245
245
|
assert_nil output["discipline_no_default"]
|
246
|
-
|
246
|
+
|
247
247
|
assert_nil @indexer.map_record(empty_record)["discipline_no_default"]
|
248
|
-
|
248
|
+
|
249
249
|
end
|
250
250
|
|
251
251
|
describe "LCC_REGEX" do
|
@@ -258,7 +258,7 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
258
258
|
|
259
259
|
describe "marc_geo_facet" do
|
260
260
|
before do
|
261
|
-
@indexer.
|
261
|
+
@indexer.configure { to_field "geo_facet", marc_geo_facet }
|
262
262
|
end
|
263
263
|
it "maps a complicated record" do
|
264
264
|
@record = MARC::Reader.new(support_file_path "multi_geo.marc").to_a.first
|
@@ -272,13 +272,13 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
272
272
|
output = @indexer.map_record(@record)
|
273
273
|
assert_nil output["geo_facet"]
|
274
274
|
assert_equal({}, @indexer.map_record(empty_record))
|
275
|
-
|
275
|
+
|
276
276
|
end
|
277
277
|
end
|
278
278
|
|
279
279
|
describe "marc_era_facet" do
|
280
280
|
before do
|
281
|
-
@indexer.
|
281
|
+
@indexer.configure { to_field "era_facet", marc_era_facet }
|
282
282
|
end
|
283
283
|
it "maps a complicated record" do
|
284
284
|
@record = MARC::Reader.new(support_file_path "multi_era.marc").to_a.first
|
@@ -287,12 +287,12 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
287
287
|
assert_equal ["Early modern, 1500-1700", "17th century", "Great Britain: Puritan Revolution, 1642-1660", "Great Britain: Civil War, 1642-1649", "1642-1660"],
|
288
288
|
output["era_facet"]
|
289
289
|
assert_equal({}, @indexer.map_record(empty_record))
|
290
|
-
|
290
|
+
|
291
291
|
end
|
292
292
|
end
|
293
293
|
|
294
294
|
describe "marc_lcsh_display" do
|
295
|
-
it "formats typical field" do
|
295
|
+
it "formats typical field" do
|
296
296
|
field = MARC::DataField.new('650', ' ', ' ', ['a', 'Psychoanalysis and literature'], ['z', 'England'], ['x', 'History'], ['y', '19th century.'])
|
297
297
|
str = Marc21Semantics.assemble_lcsh(field)
|
298
298
|
|
@@ -307,7 +307,7 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
307
307
|
assert_equal "Psychoanalysis and literature — History", str
|
308
308
|
end
|
309
309
|
|
310
|
-
it "doesn't put subdivision in wrong place" do
|
310
|
+
it "doesn't put subdivision in wrong place" do
|
311
311
|
field = MARC::DataField.new('600', ' ', ' ', ['a', 'Eliot, George,'],['d', '1819-1880.'], ['t', 'Middlemarch'])
|
312
312
|
str = Marc21Semantics.assemble_lcsh(field)
|
313
313
|
|
@@ -329,14 +329,14 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
329
329
|
describe "marc_lcsh_formatted macro" do
|
330
330
|
it "smoke test" do
|
331
331
|
@record = MARC::Reader.new(support_file_path "george_eliot.marc").to_a.first
|
332
|
-
@indexer.
|
332
|
+
@indexer.configure { to_field "lcsh", marc_lcsh_formatted }
|
333
333
|
output = @indexer.map_record(@record)
|
334
334
|
|
335
335
|
assert output["lcsh"].length > 0, "outputs data"
|
336
336
|
assert output["lcsh"].include?("Eliot, George, 1819-1880 — Characters"), "includes a string its supposed to"
|
337
|
-
|
337
|
+
|
338
338
|
assert_equal({}, @indexer.map_record(empty_record))
|
339
|
-
|
339
|
+
|
340
340
|
end
|
341
341
|
end
|
342
342
|
end
|
@@ -347,17 +347,17 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
347
347
|
end
|
348
348
|
|
349
349
|
it "works as expected" do
|
350
|
-
@indexer.
|
350
|
+
@indexer.configure do
|
351
351
|
to_field 'title_phrase', extract_marc_filing_version('245ab')
|
352
352
|
end
|
353
353
|
output = @indexer.map_record(@record)
|
354
354
|
assert_equal ['Business renaissance quarterly'], output['title_phrase']
|
355
355
|
assert_equal({}, @indexer.map_record(empty_record))
|
356
|
-
|
356
|
+
|
357
357
|
end
|
358
358
|
|
359
359
|
it "works with :include_original" do
|
360
|
-
@indexer.
|
360
|
+
@indexer.configure do
|
361
361
|
to_field 'title_phrase', extract_marc_filing_version('245ab', :include_original=>true)
|
362
362
|
end
|
363
363
|
output = @indexer.map_record(@record)
|
@@ -366,19 +366,19 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
366
366
|
end
|
367
367
|
|
368
368
|
it "doesn't do anything if you don't include the first subfield" do
|
369
|
-
@indexer.
|
369
|
+
@indexer.configure do
|
370
370
|
to_field 'title_phrase', extract_marc_filing_version('245h')
|
371
371
|
end
|
372
372
|
output = @indexer.map_record(@record)
|
373
373
|
assert_equal ['[electronic resource].'], output['title_phrase']
|
374
374
|
assert_equal({}, @indexer.map_record(empty_record))
|
375
|
-
|
375
|
+
|
376
376
|
end
|
377
377
|
|
378
378
|
|
379
379
|
it "dies if you pass it something else" do
|
380
380
|
assert_raises(RuntimeError) do
|
381
|
-
@indexer.
|
381
|
+
@indexer.configure do
|
382
382
|
to_field 'title_phrase', extract_marc_filing_version('245ab', :include_original=>true, :uniq => true)
|
383
383
|
end
|
384
384
|
end
|
@@ -17,7 +17,7 @@ describe "extract_marc" do
|
|
17
17
|
|
18
18
|
|
19
19
|
it "extracts marc" do
|
20
|
-
@indexer.
|
20
|
+
@indexer.configure do
|
21
21
|
to_field "title", extract_marc("245ab")
|
22
22
|
end
|
23
23
|
|
@@ -29,7 +29,7 @@ describe "extract_marc" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "respects :first=>true option" do
|
32
|
-
@indexer.
|
32
|
+
@indexer.configure do
|
33
33
|
to_field "other_id", extract_marc("035a", :first => true)
|
34
34
|
end
|
35
35
|
|
@@ -40,7 +40,7 @@ describe "extract_marc" do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "trims punctuation with :trim_punctuation => true" do
|
43
|
-
@indexer.
|
43
|
+
@indexer.configure do
|
44
44
|
to_field "title", extract_marc("245ab", :trim_punctuation => true)
|
45
45
|
end
|
46
46
|
|
@@ -48,11 +48,21 @@ describe "extract_marc" do
|
|
48
48
|
|
49
49
|
assert_equal ["Manufacturing consent : the political economy of the mass media"], output["title"]
|
50
50
|
assert_equal({}, @indexer.map_record(empty_record))
|
51
|
+
end
|
52
|
+
|
53
|
+
it "can use trim_punctuation as transformation macro" do
|
54
|
+
@indexer.configure do
|
55
|
+
to_field "title", extract_marc("245ab"), trim_punctuation
|
56
|
+
end
|
51
57
|
|
58
|
+
output = @indexer.map_record(@record)
|
59
|
+
|
60
|
+
assert_equal ["Manufacturing consent : the political economy of the mass media"], output["title"]
|
61
|
+
assert_equal({}, @indexer.map_record(empty_record))
|
52
62
|
end
|
53
63
|
|
54
64
|
it "respects :default option" do
|
55
|
-
@indexer.
|
65
|
+
@indexer.configure do
|
56
66
|
to_field "only_default", extract_marc("9999", :default => "DEFAULT VALUE")
|
57
67
|
end
|
58
68
|
output = @indexer.map_record(@record)
|
@@ -65,7 +75,7 @@ describe "extract_marc" do
|
|
65
75
|
f = @record.fields('008').first
|
66
76
|
@record.append(f)
|
67
77
|
|
68
|
-
@indexer.
|
78
|
+
@indexer.configure do
|
69
79
|
to_field "lang1", extract_marc('008[35-37]')
|
70
80
|
to_field "lang2", extract_marc('008[35-37]', :allow_duplicates => true)
|
71
81
|
end
|
@@ -78,7 +88,7 @@ describe "extract_marc" do
|
|
78
88
|
|
79
89
|
it "fails on an extra/misspelled argument to extract_marc" do
|
80
90
|
assert_raises(RuntimeError) do
|
81
|
-
@indexer.
|
91
|
+
@indexer.configure do
|
82
92
|
to_field "foo", extract_marc("9999", :misspelled => "Who cares")
|
83
93
|
end
|
84
94
|
end
|
@@ -86,7 +96,7 @@ describe "extract_marc" do
|
|
86
96
|
|
87
97
|
|
88
98
|
it "throws away nil values unless settings['allow_nil_values]'" do
|
89
|
-
@indexer.
|
99
|
+
@indexer.configure do
|
90
100
|
to_field 'default_nil', extract_marc('9999', :default => nil)
|
91
101
|
end
|
92
102
|
output = @indexer.map_record(@record)
|
@@ -98,7 +108,7 @@ describe "extract_marc" do
|
|
98
108
|
@indexer.settings do |s|
|
99
109
|
s['allow_nil_values'] = true
|
100
110
|
end
|
101
|
-
@indexer.
|
111
|
+
@indexer.configure do
|
102
112
|
to_field 'default_nil', extract_marc('9999', :default => nil)
|
103
113
|
end
|
104
114
|
output = @indexer.map_record(@record)
|
@@ -109,7 +119,7 @@ describe "extract_marc" do
|
|
109
119
|
|
110
120
|
|
111
121
|
it "uses :translation_map" do
|
112
|
-
@indexer.
|
122
|
+
@indexer.configure do
|
113
123
|
to_field "cataloging_agency", extract_marc("040a", :separator => nil, :translation_map => "marc_040a_translate_test")
|
114
124
|
end
|
115
125
|
output = @indexer.map_record(@record)
|
@@ -15,7 +15,7 @@ describe "serialized_marc" do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "serializes xml" do
|
18
|
-
@indexer.
|
18
|
+
@indexer.configure do
|
19
19
|
to_field "marc_record", serialized_marc(:format => "xml")
|
20
20
|
end
|
21
21
|
output = @indexer.map_record(@record)
|
@@ -27,7 +27,7 @@ describe "serialized_marc" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "serializes binary UUEncoded" do
|
30
|
-
@indexer.
|
30
|
+
@indexer.configure do
|
31
31
|
to_field "marc_record", serialized_marc(:format => "binary")
|
32
32
|
end
|
33
33
|
output = @indexer.map_record(@record)
|
@@ -42,7 +42,7 @@ describe "serialized_marc" do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it "serializes binary raw" do
|
45
|
-
@indexer.
|
45
|
+
@indexer.configure do
|
46
46
|
to_field "marc_record", serialized_marc(:format => "binary", :binary_escape => false)
|
47
47
|
end
|
48
48
|
output = @indexer.map_record(@record)
|
@@ -55,7 +55,7 @@ describe "serialized_marc" do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it "serializes json" do
|
58
|
-
@indexer.
|
58
|
+
@indexer.configure do
|
59
59
|
to_field "marc_record", serialized_marc(:format => "json")
|
60
60
|
end
|
61
61
|
output = @indexer.map_record(@record)
|
@@ -7,7 +7,7 @@ describe "Indexer Macros#to_field" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "works with simple literal" do
|
10
|
-
@indexer.
|
10
|
+
@indexer.configure do
|
11
11
|
extend Traject::Macros::Basic
|
12
12
|
|
13
13
|
to_field "source", literal("MY LIBRARY")
|
@@ -21,7 +21,7 @@ describe "Indexer Macros#to_field" do
|
|
21
21
|
it "works with macro AND block" do
|
22
22
|
called = false
|
23
23
|
|
24
|
-
@indexer.
|
24
|
+
@indexer.configure do
|
25
25
|
extend Traject::Macros::Basic
|
26
26
|
to_field "source", literal("MY LIBRARY") do |record, accumulator, context|
|
27
27
|
called = true
|