View | Details | Raw Unified | Return to bug 38416
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch.pm (-2 / +3 lines)
Lines 819-832 sub marc_records_to_documents { Link Here
819
819
820
                #NOTE: Try to round-trip the record to prove it will work for retrieval after searching
820
                #NOTE: Try to round-trip the record to prove it will work for retrieval after searching
821
                my $decoded_usmarc_record = MARC::Record->new_from_usmarc($usmarc_record);
821
                my $decoded_usmarc_record = MARC::Record->new_from_usmarc($usmarc_record);
822
                if ($decoded_usmarc_record->warnings()){
822
                if ( $decoded_usmarc_record->warnings() ) {
823
823
                    #NOTE: We override the warnings since they're many and misleading
824
                    #NOTE: We override the warnings since they're many and misleading
824
                    @warnings = (
825
                    @warnings = (
825
                        "Warnings encountered while roundtripping a MARC record to/from USMARC. Failing over to MARCXML.",
826
                        "Warnings encountered while roundtripping a MARC record to/from USMARC. Failing over to MARCXML.",
826
                    );
827
                    );
827
                }
828
                }
828
829
829
                my $marc_data = encode_base64(encode('UTF-8', $usmarc_record));
830
                my $marc_data = encode_base64( encode( 'UTF-8', $usmarc_record ) );
830
                $record_document->{'marc_data'} = $marc_data;
831
                $record_document->{'marc_data'} = $marc_data;
831
            }
832
            }
832
            if (@warnings) {
833
            if (@warnings) {
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t (-10 / +12 lines)
Lines 756-775 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
756
    $marc_record_with_large_field->leader('     cam  22      a 4500');
756
    $marc_record_with_large_field->leader('     cam  22      a 4500');
757
757
758
    $marc_record_with_large_field->append_fields(
758
    $marc_record_with_large_field->append_fields(
759
        MARC::Field->new('100', '', '', a => 'Author 1'),
759
        MARC::Field->new( '100', '', '', a => 'Author 1' ),
760
        MARC::Field->new('245', '', '', a => 'Title:', b => 'record with large field'),
760
        MARC::Field->new( '245', '', '', a => 'Title:', b => 'record with large field' ),
761
        MARC::Field->new('500', '', '', a => 'X' x 15000),
761
        MARC::Field->new( '500', '', '', a => 'X' x 15000 ),
762
        MARC::Field->new('999', '', '', c => '1234567'),
762
        MARC::Field->new( '999', '', '', c => '1234567' ),
763
    );
763
    );
764
764
765
    $docs = $see->marc_records_to_documents([$marc_record_with_large_field]);
765
    $docs = $see->marc_records_to_documents( [$marc_record_with_large_field] );
766
766
767
    is($docs->[0]->{marc_format}, 'MARCXML', 'For record with large field marc_format should be set correctly');
767
    is( $docs->[0]->{marc_format}, 'MARCXML', 'For record with large field marc_format should be set correctly' );
768
768
769
    $decoded_marc_record = $see->decode_record_from_result($docs->[0]);
769
    $decoded_marc_record = $see->decode_record_from_result( $docs->[0] );
770
770
771
    ok($decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result");
771
    ok( $decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result" );
772
    is($decoded_marc_record->as_xml_record(), $marc_record_with_large_field->as_xml_record(), "Decoded MARCXML record has same data as original record");
772
    is(
773
        $decoded_marc_record->as_xml_record(), $marc_record_with_large_field->as_xml_record(),
774
        "Decoded MARCXML record has same data as original record"
775
    );
773
776
774
};
777
};
775
778
776
- 

Return to bug 38416