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

(-)a/t/Koha/SearchEngine/Elasticsearch.t (-4 / +28 lines)
Lines 118-124 subtest 'get_elasticsearch_mappings() tests' => sub { Link Here
118
118
119
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub {
119
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub {
120
120
121
    plan tests => 56;
121
    plan tests => 57;
122
122
123
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
123
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
124
    t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709');
124
    t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709');
Lines 285-290 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
285
            marc_field => '952l',
285
            marc_field => '952l',
286
        },
286
        },
287
        {
287
        {
288
            name => 'copydate',
289
            type => 'year',
290
            facet => 0,
291
            suggestible => 0,
292
            searchable => 1,
293
            sort => 1,
294
            marc_type => 'marc21',
295
            marc_field => '260c',
296
        },
297
        {
288
            name => 'date-of-publication',
298
            name => 'date-of-publication',
289
            type => 'year',
299
            type => 'year',
290
            facet => 0,
300
            facet => 0,
Lines 333-338 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
333
        MARC::Field->new('210', '', '', a => 'Title 1'),
343
        MARC::Field->new('210', '', '', a => 'Title 1'),
334
        MARC::Field->new('240', '', '4', a => 'The uniform title with nonfiling indicator'),
344
        MARC::Field->new('240', '', '4', a => 'The uniform title with nonfiling indicator'),
335
        MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'),
345
        MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'),
346
        MARC::Field->new('260', '', '', a => 'New York :', b => 'Ace ,', c => 'c1962'),
336
        MARC::Field->new('999', '', '', c => '1234567'),
347
        MARC::Field->new('999', '', '', c => '1234567'),
337
        # '  ' for testing trimming of white space in boolean value callback:
348
        # '  ' for testing trimming of white space in boolean value callback:
338
        MARC::Field->new('952', '', '', 0 => '  ', g => '123.30', o => $callno, l => 3),
349
        MARC::Field->new('952', '', '', 0 => '  ', g => '123.30', o => $callno, l => 3),
Lines 346-351 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
346
        MARC::Field->new('100', '', '', a => 'Author 2'),
357
        MARC::Field->new('100', '', '', a => 'Author 2'),
347
        # MARC::Field->new('210', '', '', a => 'Title 2'),
358
        # MARC::Field->new('210', '', '', a => 'Title 2'),
348
        # MARC::Field->new('245', '', '', a => 'Title: second record'),
359
        # MARC::Field->new('245', '', '', a => 'Title: second record'),
360
        MARC::Field->new('260', '', '', a => 'New York :', b => 'Ace ,', c => '1963-2003'),
349
        MARC::Field->new('999', '', '', c => '1234568'),
361
        MARC::Field->new('999', '', '', c => '1234568'),
350
        MARC::Field->new('952', '', '', 0 => 1, g => 'string where should be numeric', o => $long_callno),
362
        MARC::Field->new('952', '', '', 0 => 1, g => 'string where should be numeric', o => $long_callno),
351
    );
363
    );
Lines 469-476 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
469
        'First document uniform_title__sort field should contain the title with the first four initial characters removed'
481
        'First document uniform_title__sort field should contain the title with the first four initial characters removed'
470
    );
482
    );
471
    # Tests for 'year' type and 'filter_callbacks'
483
    # Tests for 'year' type and 'filter_callbacks'
472
    is(scalar @{$docs->[0]->{'date-of-publication'}}, 1, 'First document date-of-publication field should contain one value');
473
    is_deeply($docs->[0]->{'date-of-publication'}, ['1962'], 'First document date-of-publication field should be set correctly');
484
    is_deeply($docs->[0]->{'date-of-publication'}, ['1962'], 'First document date-of-publication field should be set correctly');
485
    is_deeply(
486
        $docs->[0]->{'copydate'},
487
        ['1962'],
488
        'First document copydate field should be set correctly'
489
    );
474
490
475
    # Second record:
491
    # Second record:
476
492
Lines 497-503 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
497
    );
513
    );
498
514
499
    # Tests for 'year' type and 'filter_callbacks'
515
    # Tests for 'year' type and 'filter_callbacks'
500
    ok(!(defined $docs->[1]->{'date-of-publication'}), "Second document invalid date-of-publication value should have been removed");
516
    is_deeply(
517
        $docs->[1]->{'copydate'},
518
        ['1963','2003'],
519
        'Second document copydate field should be set correctly'
520
    );
521
    is_deeply(
522
        $docs->[1]->{'date-of-publication'},
523
        ['1900'],
524
        'Second document date-of-publication field should be set correctly'
525
    );
501
526
502
    # Mappings marc_type:
527
    # Mappings marc_type:
503
528
504
- 

Return to bug 24807