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

(-)a/t/db_dependent/Heading.t (-4 / +13 lines)
Lines 64-70 subtest "UNIMARC tests" => sub { Link Here
64
};
64
};
65
65
66
subtest "_search tests" => sub {
66
subtest "_search tests" => sub {
67
    plan tests => 4;
67
    plan tests => 5;
68
68
69
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
69
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
70
    t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch');
70
    t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch');
Lines 112-120 subtest "_search tests" => sub { Link Here
112
    $search_query = $heading->_search( 'match-heading' );
112
    $search_query = $heading->_search( 'match-heading' );
113
    $terms = $search_query->{query}->{bool}->{must};
113
    $terms = $search_query->{query}->{bool}->{must};
114
    $expected_terms = [
114
    $expected_terms = [
115
        { term => { 'match-heading.ci_raw' => 'Yankovic, Al 1959-' } },
115
        { term => { 'match-heading.ci_raw' => 'Yankovic, Al 1959' } },
116
        { term => { 'subject-heading-thesaurus.ci_raw' => 'a' } },
116
        { term => { 'subject-heading-thesaurus.ci_raw' => 'a' } },
117
    ];
117
    ];
118
    is_deeply( $terms, $expected_terms, "Search formed as expected for a non-subject field");
118
    is_deeply( $terms, $expected_terms, "Search formed as expected for a non-subject field with doulbe punctuation, hyphen+comma");
119
120
    $field = MARC::Field->new( '100', ' ', '', a => 'Tolkien, J.R.R.,', e => '[author]' );
121
    $heading = C4::Heading->new_from_field($field);
122
    $search_query = $heading->_search( 'match-heading' );
123
    $terms = $search_query->{query}->{bool}->{must};
124
    $expected_terms = [
125
        { term => { 'match-heading.ci_raw' => 'Tolkien, J.R.R' } },
126
        { term => { 'subject-heading-thesaurus.ci_raw' => 'a' } },
127
    ];
128
    is_deeply( $terms, $expected_terms, "Search formed as expected for a non-subject field with double punctuation, period+comma ");
119
129
120
};
130
};
121
- 

Return to bug 33100