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

(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-1 / +4 lines)
Lines 54-59 $se->mock( 'get_elasticsearch_mappings', sub { Link Here
54
                type => 'text',
54
                type => 'text',
55
                facet => 1
55
                facet => 1
56
            },
56
            },
57
            'subject-heading-thesaurus-conventions' => {
58
                type => 'text'
59
            },
57
            itemnumber => {
60
            itemnumber => {
58
                type => 'integer'
61
                type => 'integer'
59
            },
62
            },
Lines 101-107 $se->mock( 'get_elasticsearch_mappings', sub { Link Here
101
104
102
subtest 'build_authorities_query_compat() tests' => sub {
105
subtest 'build_authorities_query_compat() tests' => sub {
103
106
104
    plan tests => 65;
107
    plan tests => 72;
105
108
106
    my $qb;
109
    my $qb;
107
110
(-)a/t/db_dependent/Linker_Default.t (-4 / +31 lines)
Lines 42-57 my $schema = $builder->schema(); Link Here
42
$schema->storage->txn_begin;
42
$schema->storage->txn_begin;
43
43
44
subtest 'Test caching in get_link and update_cache' => sub {
44
subtest 'Test caching in get_link and update_cache' => sub {
45
    plan tests => 6;
45
    plan tests => 13;
46
46
47
    my @tags = C4::Context->preference('marcflavour') eq 'UNIMARC' ? (601,'j',602,'a') : (650,'a',655,'a');
47
    my @tags = C4::Context->preference('marcflavour') eq 'UNIMARC' ? (601,'j',602,'a') : (650,'a',655,'a');
48
48
49
    my $subject_field = MARC::Field->new($tags[0],0,2,$tags[1]=>'Science fiction');
49
    my $subject_field = MARC::Field->new($tags[0],0,2,$tags[1]=>'Science fiction');
50
    my $subject_field2 = MARC::Field->new($tags[0],0,2,$tags[1]=>'Science fiction');
50
    my $subject_field2 = MARC::Field->new($tags[0],0,2,$tags[1]=>'Science fiction');
51
    my $subject_field3 = MARC::Field->new($tags[0],0,0,$tags[1]=>'Science fiction');
52
    my $subject_field4 = MARC::Field->new($tags[0],0,7,$tags[1]=>'Science fiction','2'=>'bnb');
53
    my $subject_field5 = MARC::Field->new($tags[0],0,7,$tags[1]=>'Science fiction','2'=>'sao');
54
    my $subject_field6 = MARC::Field->new($tags[0],0,7,$tags[1]=>'Science fiction','2'=>'sao');
55
    my $subject_field7 = MARC::Field->new($tags[0],0,4,$tags[1]=>'Science fiction');
51
    my $genre_field = MARC::Field->new($tags[2],0,2,$tags[3]=>'Science fiction');
56
    my $genre_field = MARC::Field->new($tags[2],0,2,$tags[3]=>'Science fiction');
52
    # Can we build a heading from it?
57
    # Can we build a heading from it?
53
    my $subject_heading = C4::Heading->new_from_field( $subject_field, q{} );
58
    my $subject_heading = C4::Heading->new_from_field( $subject_field, q{} );
54
    my $subject_heading2 = C4::Heading->new_from_field( $subject_field, q{} );
59
    my $subject_heading2 = C4::Heading->new_from_field( $subject_field2, q{} );
60
    my $subject_heading3 = C4::Heading->new_from_field( $subject_field3, q{} );
61
    my $subject_heading4 = C4::Heading->new_from_field( $subject_field4, q{} );
62
    my $subject_heading5 = C4::Heading->new_from_field( $subject_field5, q{} );
63
    my $subject_heading6 = C4::Heading->new_from_field( $subject_field6, q{} );
64
    my $subject_heading7 = C4::Heading->new_from_field( $subject_field7, q{} );
55
    my $genre_heading = C4::Heading->new_from_field( $genre_field, q{} );
65
    my $genre_heading = C4::Heading->new_from_field( $genre_field, q{} );
56
66
57
67
Lines 67-79 subtest 'Test caching in get_link and update_cache' => sub { Link Here
67
    $linker->get_link($subject_heading2);
77
    $linker->get_link($subject_heading2);
68
    is( keys %{$linker->{cache}},2, "Third (matching) term not added to cache because of matching type");
78
    is( keys %{$linker->{cache}},2, "Third (matching) term not added to cache because of matching type");
69
79
80
    $linker->get_link($subject_heading3);
81
    is( keys %{$linker->{cache}},3, "Fourth (matching) term added to cache because of different thesaurus (lcsh)");
82
83
    $linker->get_link($subject_heading4);
84
    is( keys %{$linker->{cache}},4, "Fifth (matching) term added to cache because of different thesaurus (bnb)");
85
86
    $linker->get_link($subject_heading5);
87
    is( keys %{$linker->{cache}},5, "Sixth (matching) term added to cache because of different thesaurus (sao)");
88
89
    $linker->get_link($subject_heading6);
90
    is( keys %{$linker->{cache}},5, "Seventh (matching) term not added to cache because of matching type and thesaurus (sao)");
91
92
    $linker->get_link($subject_heading7);
93
    is( keys %{$linker->{cache}},6, "Eigth (matching) term added to cache because of thesaurus source not specified (2nd indicator is 4)");
70
94
71
    $linker->update_cache($subject_heading,32);
95
    $linker->update_cache($subject_heading,32);
72
    is( $linker->{cache}->{$subject_heading->search_form.$subject_heading->auth_type}->{authid}, 32, "Linker cache is correctly updated by 'update_cache'");
96
    is( $linker->{cache}->{$subject_heading->search_form.$subject_heading->auth_type.$subject_heading->{'thesaurus'}}->{authid}, 32, "Linker cache is correctly updated by 'update_cache'");
73
    my ( $authid, undef ) = $linker->get_link($subject_heading);
97
    my ( $authid, undef ) = $linker->get_link($subject_heading);
74
    is( $authid, 32, "Correct id is retrieved from the cache" );
98
    is( $authid, 32, "Correct id is retrieved from the cache" );
75
    ( $authid, undef ) = $linker->get_link($genre_heading);
99
    ( $authid, undef ) = $linker->get_link($genre_heading);
76
    isnt( $authid, 32, "Genre term is not updated by update_cache");
100
    isnt( $authid, 32, "Genre term is not updated by update_cache");
101
    ( $authid, undef ) = $linker->get_link($subject_heading5);
102
    is( $authid, 4, "Correct id for sao term is retrieved from the cache" );
103
    $linker->update_cache($subject_heading4,78);
104
    is( $linker->{cache}->{$subject_heading4->search_form.$subject_heading4->auth_type.$subject_heading4->{'thesaurus'}}->{authid}, 78, "Linker cache for the bnb record is correctly updated by 'update_cache'");
77
};
105
};
78
106
79
$schema->storage->txn_rollback;
107
$schema->storage->txn_rollback;
80
- 

Return to bug 30280