Lines 117-123
subtest 'get_elasticsearch_mappings() tests' => sub {
Link Here
|
117 |
|
117 |
|
118 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
118 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
119 |
|
119 |
|
120 |
plan tests => 49; |
120 |
plan tests => 51; |
121 |
|
121 |
|
122 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
122 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
123 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
123 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
Lines 263-268
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
263 |
marc_type => 'marc21', |
263 |
marc_type => 'marc21', |
264 |
marc_field => '007_/0', |
264 |
marc_field => '007_/0', |
265 |
}, |
265 |
}, |
|
|
266 |
{ |
267 |
name => 'issues', |
268 |
type => 'sum', |
269 |
facet => 0, |
270 |
suggestible => 0, |
271 |
searchable => 1, |
272 |
sort => 1, |
273 |
marc_type => 'marc21', |
274 |
marc_field => '952l', |
275 |
}, |
266 |
); |
276 |
); |
267 |
|
277 |
|
268 |
my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); |
278 |
my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); |
Lines 301-309
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
301 |
MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), |
311 |
MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), |
302 |
MARC::Field->new('999', '', '', c => '1234567'), |
312 |
MARC::Field->new('999', '', '', c => '1234567'), |
303 |
# ' ' for testing trimming of white space in boolean value callback: |
313 |
# ' ' for testing trimming of white space in boolean value callback: |
304 |
MARC::Field->new('952', '', '', 0 => ' ', g => '123.30', o => $callno), |
314 |
MARC::Field->new('952', '', '', 0 => ' ', g => '123.30', o => $callno, l => 3), |
305 |
MARC::Field->new('952', '', '', 0 => 0, g => '127.20', o => $callno2), |
315 |
MARC::Field->new('952', '', '', 0 => 0, g => '127.20', o => $callno2, l => 2), |
306 |
MARC::Field->new('952', '', '', 0 => 1, g => '0.00', o => $long_callno), |
316 |
MARC::Field->new('952', '', '', 0 => 1, g => '0.00', o => $long_callno, l => 1), |
307 |
); |
317 |
); |
308 |
my $marc_record_2 = MARC::Record->new(); |
318 |
my $marc_record_2 = MARC::Record->new(); |
309 |
$marc_record_2->leader(' cam 22 a 4500'); |
319 |
$marc_record_2->leader(' cam 22 a 4500'); |
Lines 336-344
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
336 |
is(scalar @{$docs->[0]->{title__sort}}, 1, 'First document title__sort field should have a single'); |
346 |
is(scalar @{$docs->[0]->{title__sort}}, 1, 'First document title__sort field should have a single'); |
337 |
is_deeply($docs->[0]->{title__sort}, ['Title: first record Title: first record'], 'First document title__sort field should be set correctly'); |
347 |
is_deeply($docs->[0]->{title__sort}, ['Title: first record Title: first record'], 'First document title__sort field should be set correctly'); |
338 |
|
348 |
|
|
|
349 |
is($docs->[0]->{issues}, 6, 'Issues field should be sum of the issues for each item'); |
350 |
is($docs->[0]->{issues__sort}, 6, 'Issues sort field should also be a sum of the issues'); |
351 |
|
339 |
is(scalar @{$docs->[0]->{title_wildcard}}, 2, 'First document title_wildcard field should have two values'); |
352 |
is(scalar @{$docs->[0]->{title_wildcard}}, 2, 'First document title_wildcard field should have two values'); |
340 |
is_deeply($docs->[0]->{title_wildcard}, ['Title:', 'first record'], 'First document title_wildcard field should be set correctly'); |
353 |
is_deeply($docs->[0]->{title_wildcard}, ['Title:', 'first record'], 'First document title_wildcard field should be set correctly'); |
341 |
|
354 |
|
|
|
355 |
|
342 |
is(scalar @{$docs->[0]->{author__suggestion}}, 2, 'First document author__suggestion field should contain two values'); |
356 |
is(scalar @{$docs->[0]->{author__suggestion}}, 2, 'First document author__suggestion field should contain two values'); |
343 |
is_deeply( |
357 |
is_deeply( |
344 |
$docs->[0]->{author__suggestion}, |
358 |
$docs->[0]->{author__suggestion}, |
345 |
- |
|
|