Lines 132-138
subtest 'get_elasticsearch_mappings() tests' => sub {
Link Here
|
132 |
|
132 |
|
133 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
133 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
134 |
|
134 |
|
135 |
plan tests => 53; |
135 |
plan tests => 55; |
136 |
|
136 |
|
137 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
137 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
138 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
138 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
Lines 298-303
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
298 |
marc_type => 'marc21', |
298 |
marc_type => 'marc21', |
299 |
marc_field => '952l', |
299 |
marc_field => '952l', |
300 |
}, |
300 |
}, |
|
|
301 |
{ |
302 |
name => 'subject', |
303 |
type => 'string', |
304 |
facet => 0, |
305 |
suggestible => 0, |
306 |
searchable => 1, |
307 |
sort => 1, |
308 |
marc_type => 'marc21', |
309 |
marc_field => '650(avxyz)', |
310 |
}, |
301 |
); |
311 |
); |
302 |
|
312 |
|
303 |
my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); |
313 |
my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); |
Lines 335-340
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
335 |
MARC::Field->new('210', '', '', a => 'Title 1'), |
345 |
MARC::Field->new('210', '', '', a => 'Title 1'), |
336 |
MARC::Field->new('240', '', '4', a => 'The uniform title with nonfiling indicator'), |
346 |
MARC::Field->new('240', '', '4', a => 'The uniform title with nonfiling indicator'), |
337 |
MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), |
347 |
MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), |
|
|
348 |
MARC::Field->new('650', '', '', a => 'Heading', z => 'Geohead', v => 'Formhead'), |
349 |
MARC::Field->new('650', '', '', a => 'Heading', x => 'Gensubhead', z => 'Geohead'), |
338 |
MARC::Field->new('999', '', '', c => '1234567'), |
350 |
MARC::Field->new('999', '', '', c => '1234567'), |
339 |
# ' ' for testing trimming of white space in boolean value callback: |
351 |
# ' ' for testing trimming of white space in boolean value callback: |
340 |
MARC::Field->new('952', '', '', 0 => ' ', g => '123.30', o => $callno, l => 3), |
352 |
MARC::Field->new('952', '', '', 0 => ' ', g => '123.30', o => $callno, l => 3), |
Lines 366-371
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
366 |
is(scalar @{$docs->[0]->{author}}, 2, 'First document author field should contain two values'); |
378 |
is(scalar @{$docs->[0]->{author}}, 2, 'First document author field should contain two values'); |
367 |
is_deeply($docs->[0]->{author}, ['Author 1', 'Corp Author'], 'First document author field should be set correctly'); |
379 |
is_deeply($docs->[0]->{author}, ['Author 1', 'Corp Author'], 'First document author field should be set correctly'); |
368 |
|
380 |
|
|
|
381 |
is(scalar @{$docs->[0]->{subject}}, 2, 'First document subject field should contain two values'); |
382 |
is_deeply($docs->[0]->{subject}, ['Heading Geohead Formhead', 'Heading Gensubhead Geohead'], 'First document asubject field should be set correctly, record order preserved for grouped subfield mapping'); |
383 |
|
369 |
is(scalar @{$docs->[0]->{author__sort}}, 1, 'First document author__sort field should have a single value'); |
384 |
is(scalar @{$docs->[0]->{author__sort}}, 1, 'First document author__sort field should have a single value'); |
370 |
is_deeply($docs->[0]->{author__sort}, ['Author 1 Corp Author'], 'First document author__sort field should be set correctly'); |
385 |
is_deeply($docs->[0]->{author__sort}, ['Author 1 Corp Author'], 'First document author__sort field should be set correctly'); |
371 |
|
386 |
|
Lines 651-657
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () t
Link Here
|
651 |
|
666 |
|
652 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authority tests' => sub { |
667 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authority tests' => sub { |
653 |
|
668 |
|
654 |
plan tests => 2; |
669 |
plan tests => 3; |
655 |
|
670 |
|
656 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
671 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
657 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
672 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
Lines 671-677
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori
Link Here
|
671 |
searchable => 1, |
686 |
searchable => 1, |
672 |
sort => 0, |
687 |
sort => 0, |
673 |
marc_type => 'marc21', |
688 |
marc_type => 'marc21', |
674 |
marc_field => '150(ae)', |
689 |
marc_field => '150(aevxyz)', |
675 |
} |
690 |
} |
676 |
); |
691 |
); |
677 |
|
692 |
|
Lines 711-726
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori
Link Here
|
711 |
|
726 |
|
712 |
my $docs = $see->marc_records_to_documents($records); |
727 |
my $docs = $see->marc_records_to_documents($records); |
713 |
|
728 |
|
714 |
ok( |
729 |
is_deeply( |
715 |
any { $_ eq "Subject formsubdiv Genresubdiv generalsubdiv Generalsubdiv geographicsubdiv Geosubdiv" } |
730 |
[ "Subject formsubdiv Genresubdiv generalsubdiv Generalsubdiv geographicsubdiv Geosubdiv" ], |
716 |
@{$docs->[0]->{'match-heading'}}, |
731 |
$docs->[0]->{'match-heading'}, |
717 |
"First record match-heading should contain the correctly formatted heading" |
732 |
"First record match-heading should contain the correctly formatted heading" |
718 |
); |
733 |
); |
719 |
ok( |
734 |
is_deeply( |
720 |
any { $_ eq "Subject formsubdiv Genresubdiv geographicsubdiv Geosubdiv generalsubdiv Generalsubdiv" } |
735 |
[ "Subject formsubdiv Genresubdiv geographicsubdiv Geosubdiv generalsubdiv Generalsubdiv" ], |
721 |
@{$docs->[1]->{'match-heading'}}, |
736 |
$docs->[1]->{'match-heading'}, |
722 |
"Second record match-heading should contain the correctly formatted heading without wrong subfield" |
737 |
"Second record match-heading should contain the correctly formatted heading without wrong subfield" |
723 |
); |
738 |
); |
|
|
739 |
is_deeply( |
740 |
[ "Subject Genresubdiv Geosubdiv Generalsubdiv wrongsubdiv" ], |
741 |
$docs->[1]->{'match'} , |
742 |
"Second record heading should contain the subfields with record order retained" |
743 |
); |
724 |
}; |
744 |
}; |
725 |
|
745 |
|
726 |
$schema->storage->txn_rollback; |
746 |
$schema->storage->txn_rollback; |
727 |
- |
|
|