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

(-)a/C4/Heading.pm (-1 / +4 lines)
Lines 211-217 sub _search { Link Here
211
        push @value,    $self->{'search_form'};
211
        push @value,    $self->{'search_form'};
212
    }
212
    }
213
213
214
    if ( $thesaurus ) {
214
    # FIXME we don't have a method for negative search
215
    # but 'notspecified' should be 'not n' - the best
216
    # we can achieve currently is to ignore the thesaurus
217
    if ( $thesaurus && $thesaurus ne 'notspecified' ) {
215
        push @marclist, 'thesaurus';
218
        push @marclist, 'thesaurus';
216
        push @and_or, 'and';
219
        push @and_or, 'and';
217
        push @excluding, '';
220
        push @excluding, '';
(-)a/t/db_dependent/Heading.t (-2 / +10 lines)
Lines 65-71 subtest "UNIMARC tests" => sub { Link Here
65
65
66
subtest "_search tests" => sub {
66
subtest "_search tests" => sub {
67
67
68
    plan tests => 7;
68
    plan tests => 8;
69
69
70
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
70
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
71
    t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch');
71
    t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch');
Lines 111-116 subtest "_search tests" => sub { Link Here
111
    ];
111
    ];
112
    is_deeply( $terms, $expected_terms, "Search formed as expected with second indicator 7 and subfield 2");
112
    is_deeply( $terms, $expected_terms, "Search formed as expected with second indicator 7 and subfield 2");
113
113
114
    $field = MARC::Field->new( '650', ' ', '4', a => 'Uncles', x => 'Fiction' );
115
    $heading = C4::Heading->new_from_field($field);
116
    ($search_query) = $heading->_search( 'match-heading' );
117
    $terms = $search_query->{query}->{bool}->{must};
118
    $expected_terms = [
119
        { term => { 'match-heading.ci_raw' => 'Uncles generalsubdiv Fiction' } },
120
    ];
121
    is_deeply( $terms, $expected_terms, "Search doesn't specify thesaurus when heading marked as 'notspecified'");
122
114
    $field = MARC::Field->new( '100', ' ', '', a => 'Yankovic, Al', d => '1959-,' );
123
    $field = MARC::Field->new( '100', ' ', '', a => 'Yankovic, Al', d => '1959-,' );
115
    $heading = C4::Heading->new_from_field($field);
124
    $heading = C4::Heading->new_from_field($field);
116
    ($search_query) = $heading->_search( 'match-heading' );
125
    ($search_query) = $heading->_search( 'match-heading' );
117
- 

Return to bug 33277