|
Lines 16-22
Link Here
|
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
use Encode; |
19 |
use utf8; |
| 20 |
|
20 |
|
| 21 |
use Test::More tests => 8; |
21 |
use Test::More tests => 8; |
| 22 |
use Test::Exception; |
22 |
use Test::Exception; |
|
Lines 187-196
subtest 'get_elasticsearch_mappings() tests' => sub {
Link Here
|
| 187 |
|
187 |
|
| 188 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
188 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
| 189 |
|
189 |
|
| 190 |
plan tests => 70; |
190 |
plan tests => 81; |
| 191 |
|
191 |
|
| 192 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
192 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
| 193 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
193 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'base64ISO2709'); |
| 194 |
|
194 |
|
| 195 |
my @mappings = ( |
195 |
my @mappings = ( |
| 196 |
{ |
196 |
{ |
|
Lines 404-409
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 404 |
marc_type => 'marc21', |
404 |
marc_type => 'marc21', |
| 405 |
marc_field => '522a', |
405 |
marc_field => '522a', |
| 406 |
}, |
406 |
}, |
|
|
407 |
{ |
| 408 |
name => 'local-number', |
| 409 |
type => 'string', |
| 410 |
facet => 0, |
| 411 |
suggestible => 0, |
| 412 |
searchable => 1, |
| 413 |
sort => 1, |
| 414 |
marc_type => 'marc21', |
| 415 |
marc_field => '999c', |
| 416 |
}, |
| 407 |
); |
417 |
); |
| 408 |
|
418 |
|
| 409 |
my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); |
419 |
my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); |
|
Lines 432-438
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 432 |
my $long_callno = '1234567890' x 30; |
442 |
my $long_callno = '1234567890' x 30; |
| 433 |
|
443 |
|
| 434 |
my $marc_record_1 = MARC::Record->new(); |
444 |
my $marc_record_1 = MARC::Record->new(); |
| 435 |
$marc_record_1->leader(' cam 22 a 4500'); |
445 |
$marc_record_1->leader(' cam a22 a 4500'); |
| 436 |
$marc_record_1->append_fields( |
446 |
$marc_record_1->append_fields( |
| 437 |
MARC::Field->new('001', '123'), |
447 |
MARC::Field->new('001', '123'), |
| 438 |
MARC::Field->new('007', 'ku'), |
448 |
MARC::Field->new('007', 'ku'), |
|
Lines 452-459
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 452 |
MARC::Field->new('952', '', '', 0 => 0, g => '127.20', o => $callno2, l => 2), |
462 |
MARC::Field->new('952', '', '', 0 => 0, g => '127.20', o => $callno2, l => 2), |
| 453 |
MARC::Field->new('952', '', '', 0 => 1, g => '0.00', o => $long_callno, l => 1), |
463 |
MARC::Field->new('952', '', '', 0 => 1, g => '0.00', o => $long_callno, l => 1), |
| 454 |
); |
464 |
); |
|
|
465 |
|
| 455 |
my $marc_record_2 = MARC::Record->new(); |
466 |
my $marc_record_2 = MARC::Record->new(); |
| 456 |
$marc_record_2->leader(' cam 22 a 4500'); |
467 |
$marc_record_2->leader(' cam a22 a 4500'); |
| 457 |
$marc_record_2->append_fields( |
468 |
$marc_record_2->append_fields( |
| 458 |
MARC::Field->new('008', '901111s19uu xxk|||| |00| ||eng c'), |
469 |
MARC::Field->new('008', '901111s19uu xxk|||| |00| ||eng c'), |
| 459 |
MARC::Field->new('100', '', '', a => 'Author 2'), |
470 |
MARC::Field->new('100', '', '', a => 'Author 2'), |
|
Lines 465-471
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 465 |
); |
476 |
); |
| 466 |
|
477 |
|
| 467 |
my $marc_record_3 = MARC::Record->new(); |
478 |
my $marc_record_3 = MARC::Record->new(); |
| 468 |
$marc_record_3->leader(' cam 22 a 4500'); |
479 |
$marc_record_3->leader(' cam a22 a 4500'); |
| 469 |
$marc_record_3->append_fields( |
480 |
$marc_record_3->append_fields( |
| 470 |
MARC::Field->new('008', '901111s19uu xxk|||| |00| ||eng c'), |
481 |
MARC::Field->new('008', '901111s19uu xxk|||| |00| ||eng c'), |
| 471 |
MARC::Field->new('100', '', '', a => 'Author 2'), |
482 |
MARC::Field->new('100', '', '', a => 'Author 2'), |
|
Lines 477-483
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 477 |
); |
488 |
); |
| 478 |
|
489 |
|
| 479 |
my $marc_record_4 = MARC::Record->new(); |
490 |
my $marc_record_4 = MARC::Record->new(); |
| 480 |
$marc_record_4->leader(' cam 22 a 4500'); |
491 |
$marc_record_4->leader(' cam a22 a 4500'); |
| 481 |
$marc_record_4->append_fields( |
492 |
$marc_record_4->append_fields( |
| 482 |
MARC::Field->new( '008', '901111s19uu xxk|||| |00| ||eng c' ), |
493 |
MARC::Field->new( '008', '901111s19uu xxk|||| |00| ||eng c' ), |
| 483 |
MARC::Field->new( '100', '', '', a => 'Author 2' ), |
494 |
MARC::Field->new( '100', '', '', a => 'Author 2' ), |
|
Lines 580-586
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 580 |
ok(defined $docs->[0]->{marc_format}, 'First document marc_format field should be set'); |
591 |
ok(defined $docs->[0]->{marc_format}, 'First document marc_format field should be set'); |
| 581 |
is($docs->[0]->{marc_format}, 'base64ISO2709', 'First document marc_format should be set correctly'); |
592 |
is($docs->[0]->{marc_format}, 'base64ISO2709', 'First document marc_format should be set correctly'); |
| 582 |
|
593 |
|
| 583 |
my $decoded_marc_record = $see->decode_record_from_result($docs->[0]); |
594 |
my $decoded_marc_record = $see->search_document_marc_record_decode($docs->[0]); |
| 584 |
|
595 |
|
| 585 |
ok($decoded_marc_record->isa('MARC::Record'), "base64ISO2709 record successfully decoded from result"); |
596 |
ok($decoded_marc_record->isa('MARC::Record'), "base64ISO2709 record successfully decoded from result"); |
| 586 |
is($decoded_marc_record->as_usmarc(), $marc_record_1->as_usmarc(), "Decoded base64ISO2709 record has same data as original record"); |
597 |
is($decoded_marc_record->as_usmarc(), $marc_record_1->as_usmarc(), "Decoded base64ISO2709 record has same data as original record"); |
|
Lines 681-697
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 681 |
# Marc serialization format fallback for records exceeding ISO2709 max record size |
692 |
# Marc serialization format fallback for records exceeding ISO2709 max record size |
| 682 |
|
693 |
|
| 683 |
my $large_marc_record = MARC::Record->new(); |
694 |
my $large_marc_record = MARC::Record->new(); |
| 684 |
$large_marc_record->leader(' cam 22 a 4500'); |
695 |
$large_marc_record->leader(' cam a22 a 4500'); |
| 685 |
|
696 |
|
| 686 |
$large_marc_record->append_fields( |
697 |
$large_marc_record->append_fields( |
| 687 |
MARC::Field->new('100', '', '', a => 'Author 1'), |
698 |
MARC::Field->new('100', '', '', a => 'Author 1'), |
| 688 |
MARC::Field->new('110', '', '', a => 'Corp Author'), |
699 |
MARC::Field->new('110', '', '', a => 'Corp Author'), |
| 689 |
MARC::Field->new('210', '', '', a => 'Title 1'), |
700 |
MARC::Field->new('210', '', '', a => 'Title 1'), |
| 690 |
MARC::Field->new('245', '', '', a => 'Title:', b => 'large record'), |
701 |
# "|" is for testing escaping for multiple values with custom format |
| 691 |
MARC::Field->new('999', '', '', c => '1234567'), |
702 |
MARC::Field->new('245', '', '', a => 'Title:', b => 'large | record'), |
|
|
703 |
MARC::Field->new('999', '', '', c => '1234569'), |
| 692 |
); |
704 |
); |
| 693 |
|
705 |
|
| 694 |
my $item_field = MARC::Field->new('952', '', '', o => '123456789123456789123456789', p => '123456789', z => Encode::decode('UTF-8','To naprawdę bardzo długa notatka. Myślę, że będzie sprawiać kłopoty.')); |
706 |
my $item_field = MARC::Field->new('952', '', '', o => '123456789123456789123456789', p => '123456789', z => 'To naprawdę bardzo długa notatka. Myślę, że będzie sprawiać kłopoty.'); |
| 695 |
my $items_count = 1638; |
707 |
my $items_count = 1638; |
| 696 |
while(--$items_count) { |
708 |
while(--$items_count) { |
| 697 |
$large_marc_record->append_fields($item_field); |
709 |
$large_marc_record->append_fields($item_field); |
|
Lines 701-711
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 701 |
|
713 |
|
| 702 |
is($docs->[0]->{marc_format}, 'MARCXML', 'For record exceeding max record size marc_format should be set correctly'); |
714 |
is($docs->[0]->{marc_format}, 'MARCXML', 'For record exceeding max record size marc_format should be set correctly'); |
| 703 |
|
715 |
|
| 704 |
$decoded_marc_record = $see->decode_record_from_result($docs->[0]); |
716 |
$decoded_marc_record = $see->search_document_marc_record_decode($docs->[0]); |
| 705 |
|
717 |
|
| 706 |
ok($decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result"); |
718 |
ok($decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result"); |
| 707 |
is($decoded_marc_record->as_xml_record(), $large_marc_record->as_xml_record(), "Decoded MARCXML record has same data as original record"); |
719 |
is($decoded_marc_record->as_xml_record(), $large_marc_record->as_xml_record(), "Decoded MARCXML record has same data as original record"); |
| 708 |
|
720 |
|
|
|
721 |
# Search export functionality |
| 722 |
# Koha::SearchEngine::Elasticsearch::search_documents_encode() |
| 723 |
my @source_docs = ($marc_record_1, $marc_record_2, $large_marc_record); |
| 724 |
my @es_response_docs; |
| 725 |
my $records_data; |
| 726 |
|
| 727 |
for my $es_marc_format ('MARCXML', 'ARRAY', 'base64ISO2709') { |
| 728 |
|
| 729 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', $es_marc_format); |
| 730 |
|
| 731 |
$docs = $see->marc_records_to_documents(\@source_docs); |
| 732 |
|
| 733 |
# Emulate Elasticsearch response docs structure |
| 734 |
@es_response_docs = map { { _source => $_ } } @{$docs}; |
| 735 |
|
| 736 |
$records_data = $see->search_documents_encode(\@es_response_docs, 'ISO2709'); |
| 737 |
|
| 738 |
# $large_marc_record should not have been encoded as ISO2709 |
| 739 |
# since exceeds maximum size, see above |
| 740 |
my @tmp = ($marc_record_1, $marc_record_2); |
| 741 |
is( |
| 742 |
$records_data->{ISO2709}, |
| 743 |
join('', map { $_->as_usmarc() } @tmp), |
| 744 |
"ISO2709 encoded records from Elasticsearch result are identical with source records using index format \"$es_marc_format\"" |
| 745 |
); |
| 746 |
|
| 747 |
my $expected_marc_xml = join("\n", |
| 748 |
MARC::File::XML::header(), |
| 749 |
MARC::File::XML::record($large_marc_record, 'MARC21'), |
| 750 |
MARC::File::XML::footer() |
| 751 |
); |
| 752 |
|
| 753 |
is( |
| 754 |
$records_data->{MARCXML}, |
| 755 |
$expected_marc_xml, |
| 756 |
"Record from search result encoded as MARCXML since exceeding ISO2709 maximum size is identical with source record using index format \"$es_marc_format\"" |
| 757 |
); |
| 758 |
|
| 759 |
$records_data = $see->search_documents_encode(\@es_response_docs, 'MARCXML'); |
| 760 |
|
| 761 |
$expected_marc_xml = join("\n", |
| 762 |
MARC::File::XML::header(), |
| 763 |
join("\n", map { MARC::File::XML::record($_, 'MARC21') } @source_docs), |
| 764 |
MARC::File::XML::footer() |
| 765 |
); |
| 766 |
|
| 767 |
is( |
| 768 |
$records_data->{MARCXML}, |
| 769 |
$expected_marc_xml, |
| 770 |
"MARCXML encoded records from Elasticsearch result are identical with source records using index format \"$es_marc_format\"" |
| 771 |
); |
| 772 |
} |
| 773 |
|
| 774 |
my $custom_formats = <<'END'; |
| 775 |
- name: Biblionumbers |
| 776 |
fields: [local-number] |
| 777 |
multiple: ignore |
| 778 |
- name: Title and author |
| 779 |
fields: [title, author] |
| 780 |
multiple: join |
| 781 |
END |
| 782 |
t::lib::Mocks::mock_preference('ElasticsearchSearchResultExportCustomFormats', $custom_formats); |
| 783 |
$custom_formats = C4::Context->yaml_preference('ElasticsearchSearchResultExportCustomFormats'); |
| 784 |
|
| 785 |
# Biblionumbers custom format |
| 786 |
$records_data = $see->search_documents_custom_format_encode(\@es_response_docs, $custom_formats->[0]); |
| 787 |
# UTF-8 encode? |
| 788 |
is( |
| 789 |
$records_data, |
| 790 |
"1234567\n1234568\n1234569", |
| 791 |
"Records where correctly encoded for the custom format \"Biblionumbers\"" |
| 792 |
); |
| 793 |
|
| 794 |
# Title and author custom format |
| 795 |
$records_data = $see->search_documents_custom_format_encode(\@es_response_docs, $custom_formats->[1]); |
| 796 |
|
| 797 |
my $encoded_data = join( |
| 798 |
"\n", |
| 799 |
"\"Title:|first record|Title: first record\",\"Author 1|Corp Author\"", |
| 800 |
"\"\",\"Author 2\"", |
| 801 |
"\"Title:|large \\| record|Title: large \\| record\",\"Author 1|Corp Author\"" |
| 802 |
); |
| 803 |
|
| 804 |
is( |
| 805 |
$records_data, |
| 806 |
$encoded_data, |
| 807 |
"Records where correctly encoded for the custom format \"Title and author\"" |
| 808 |
); |
| 809 |
|
| 709 |
push @mappings, { |
810 |
push @mappings, { |
| 710 |
name => 'title', |
811 |
name => 'title', |
| 711 |
type => 'string', |
812 |
type => 'string', |
|
Lines 751-757
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 751 |
|
852 |
|
| 752 |
pop @mappings; |
853 |
pop @mappings; |
| 753 |
my $marc_record_with_blank_field = MARC::Record->new(); |
854 |
my $marc_record_with_blank_field = MARC::Record->new(); |
| 754 |
$marc_record_with_blank_field->leader(' cam 22 a 4500'); |
855 |
$marc_record_with_blank_field->leader(' cam a22 a 4500'); |
| 755 |
|
856 |
|
| 756 |
$marc_record_with_blank_field->append_fields( |
857 |
$marc_record_with_blank_field->append_fields( |
| 757 |
MARC::Field->new('100', '', '', a => ''), |
858 |
MARC::Field->new('100', '', '', a => ''), |
|
Lines 764-770
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 764 |
is_deeply( $docs->[0]->{author__suggestion},[],'No value placed into suggestion if mapped marc field is blank'); |
865 |
is_deeply( $docs->[0]->{author__suggestion},[],'No value placed into suggestion if mapped marc field is blank'); |
| 765 |
|
866 |
|
| 766 |
my $marc_record_with_large_field = MARC::Record->new(); |
867 |
my $marc_record_with_large_field = MARC::Record->new(); |
| 767 |
$marc_record_with_large_field->leader(' cam 22 a 4500'); |
868 |
$marc_record_with_large_field->leader(' cam a22 a 4500'); |
| 768 |
|
869 |
|
| 769 |
my $xs = 'X' x 8191; |
870 |
my $xs = 'X' x 8191; |
| 770 |
my $ys = 'Y' x 8191; |
871 |
my $ys = 'Y' x 8191; |
|
Lines 794-800
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 794 |
|
895 |
|
| 795 |
is( $docs->[0]->{marc_format}, 'MARCXML', 'For record with large field marc_format should be set correctly' ); |
896 |
is( $docs->[0]->{marc_format}, 'MARCXML', 'For record with large field marc_format should be set correctly' ); |
| 796 |
|
897 |
|
| 797 |
$decoded_marc_record = $see->decode_record_from_result( $docs->[0] ); |
898 |
$decoded_marc_record = $see->search_document_marc_record_decode( $docs->[0] ); |
| 798 |
|
899 |
|
| 799 |
ok( $decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result" ); |
900 |
ok( $decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result" ); |
| 800 |
is( |
901 |
is( |
|
Lines 846-852
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () t
Link Here
|
| 846 |
my $see = Koha::SearchEngine::Elasticsearch::Search->new({ index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX }); |
947 |
my $see = Koha::SearchEngine::Elasticsearch::Search->new({ index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX }); |
| 847 |
|
948 |
|
| 848 |
my $marc_record_1 = MARC::Record->new(); |
949 |
my $marc_record_1 = MARC::Record->new(); |
| 849 |
$marc_record_1->leader(' cam 22 a 4500'); |
950 |
$marc_record_1->leader(' cam a22 a 4500'); |
| 850 |
$marc_record_1->append_fields( |
951 |
$marc_record_1->append_fields( |
| 851 |
MARC::Field->new('001', '123'), |
952 |
MARC::Field->new('001', '123'), |
| 852 |
MARC::Field->new('020', '', '', a => '1-56619-909-3'), |
953 |
MARC::Field->new('020', '', '', a => '1-56619-909-3'), |
|
Lines 857-863
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () t
Link Here
|
| 857 |
MARC::Field->new('999', '', '', c => '1234567'), |
958 |
MARC::Field->new('999', '', '', c => '1234567'), |
| 858 |
); |
959 |
); |
| 859 |
my $marc_record_2 = MARC::Record->new(); |
960 |
my $marc_record_2 = MARC::Record->new(); |
| 860 |
$marc_record_2->leader(' cam 22 a 4500'); |
961 |
$marc_record_2->leader(' cam a22 a 4500'); |
| 861 |
$marc_record_2->append_fields( |
962 |
$marc_record_2->append_fields( |
| 862 |
MARC::Field->new('100', '', '', a => 'Author 2'), |
963 |
MARC::Field->new('100', '', '', a => 'Author 2'), |
| 863 |
# MARC::Field->new('210', '', '', a => 'Title 2'), |
964 |
# MARC::Field->new('210', '', '', a => 'Title 2'), |
|
Lines 878-884
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () t
Link Here
|
| 878 |
|
979 |
|
| 879 |
is($docs->[0]->{marc_format}, 'ARRAY', 'First document marc_format should be set correctly'); |
980 |
is($docs->[0]->{marc_format}, 'ARRAY', 'First document marc_format should be set correctly'); |
| 880 |
|
981 |
|
| 881 |
my $decoded_marc_record = $see->decode_record_from_result($docs->[0]); |
982 |
my $decoded_marc_record = $see->search_document_marc_record_decode($docs->[0]); |
| 882 |
|
983 |
|
| 883 |
ok($decoded_marc_record->isa('MARC::Record'), "ARRAY record successfully decoded from result"); |
984 |
ok($decoded_marc_record->isa('MARC::Record'), "ARRAY record successfully decoded from result"); |
| 884 |
is($decoded_marc_record->as_usmarc(), $marc_record_1->as_usmarc(), "Decoded ARRAY record has same data as original record"); |
985 |
is($decoded_marc_record->as_usmarc(), $marc_record_1->as_usmarc(), "Decoded ARRAY record has same data as original record"); |
|
Lines 889-895
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () authori
Link Here
|
| 889 |
plan tests => 5; |
990 |
plan tests => 5; |
| 890 |
|
991 |
|
| 891 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
992 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
| 892 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); |
993 |
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'base64ISO2709'); |
| 893 |
|
994 |
|
| 894 |
my $builder = t::lib::TestBuilder->new; |
995 |
my $builder = t::lib::TestBuilder->new; |
| 895 |
my $auth_type = $builder->build_object({ class => 'Koha::Authority::Types', value =>{ |
996 |
my $auth_type = $builder->build_object({ class => 'Koha::Authority::Types', value =>{ |
|
Lines 1005-1010
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents with Inclu
Link Here
|
| 1005 |
MARC::Field->new(150, '', '', a => 'Foo'), |
1106 |
MARC::Field->new(150, '', '', a => 'Foo'), |
| 1006 |
MARC::Field->new(450, '', '', a => 'Bar'), |
1107 |
MARC::Field->new(450, '', '', a => 'Bar'), |
| 1007 |
); |
1108 |
); |
|
|
1109 |
$authority_record->encoding('UTF-8'); |
| 1008 |
$dbh->do( "INSERT INTO auth_header (datecreated,marcxml) values (NOW(),?)", undef, ($authority_record->as_xml_record('MARC21') ) ); |
1110 |
$dbh->do( "INSERT INTO auth_header (datecreated,marcxml) values (NOW(),?)", undef, ($authority_record->as_xml_record('MARC21') ) ); |
| 1009 |
my $authid = $dbh->last_insert_id( undef, undef, 'auth_header', 'authid' ); |
1111 |
my $authid = $dbh->last_insert_id( undef, undef, 'auth_header', 'authid' ); |
| 1010 |
|
1112 |
|
|
Lines 1043-1049
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents with Inclu
Link Here
|
| 1043 |
my $see = Koha::SearchEngine::Elasticsearch::Search->new({ index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX }); |
1145 |
my $see = Koha::SearchEngine::Elasticsearch::Search->new({ index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX }); |
| 1044 |
|
1146 |
|
| 1045 |
my $marc_record_1 = MARC::Record->new(); |
1147 |
my $marc_record_1 = MARC::Record->new(); |
| 1046 |
$marc_record_1->leader(' cam 22 a 4500'); |
1148 |
$marc_record_1->leader(' cam a22 a 4500'); |
| 1047 |
$marc_record_1->append_fields( |
1149 |
$marc_record_1->append_fields( |
| 1048 |
MARC::Field->new('001', '123'), |
1150 |
MARC::Field->new('001', '123'), |
| 1049 |
MARC::Field->new('245', '', '', a => 'Title'), |
1151 |
MARC::Field->new('245', '', '', a => 'Title'), |
|
Lines 1077-1083
subtest 'marc_records_to_documents should set the "available" field' => sub {
Link Here
|
| 1077 |
$see->get_elasticsearch_mappings(); |
1179 |
$see->get_elasticsearch_mappings(); |
| 1078 |
|
1180 |
|
| 1079 |
my $marc_record_1 = MARC::Record->new(); |
1181 |
my $marc_record_1 = MARC::Record->new(); |
| 1080 |
$marc_record_1->leader(' cam 22 a 4500'); |
1182 |
$marc_record_1->leader(' cam a22 a 4500'); |
| 1081 |
$marc_record_1->append_fields( |
1183 |
$marc_record_1->append_fields( |
| 1082 |
MARC::Field->new('245', '', '', a => 'Title'), |
1184 |
MARC::Field->new('245', '', '', a => 'Title'), |
| 1083 |
); |
1185 |
); |
| 1084 |
- |
|
|