Bugzilla – Attachment 148495 Details for
Bug 33277
Correctly handle linking subfields with no defined thesaurus
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33277: Don't search thesaurus when heading 'notspecified'
Bug-33277-Dont-search-thesaurus-when-heading-notsp.patch (text/plain), 2.18 KB, created by
Nick Clemens (kidclamp)
on 2023-03-21 19:36:11 UTC
(
hide
)
Description:
Bug 33277: Don't search thesaurus when heading 'notspecified'
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-03-21 19:36:11 UTC
Size:
2.18 KB
patch
obsolete
>From 3cbac6fecd29a16354e31284702f1776ed086913 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 21 Mar 2023 19:34:50 +0000 >Subject: [PATCH] Bug 33277: Don't search thesaurus when heading 'notspecified' > >--- > C4/Heading.pm | 5 ++++- > t/db_dependent/Heading.t | 11 ++++++++++- > 2 files changed, 14 insertions(+), 2 deletions(-) > >diff --git a/C4/Heading.pm b/C4/Heading.pm >index 5c393b4d53..0e45a66624 100644 >--- a/C4/Heading.pm >+++ b/C4/Heading.pm >@@ -211,7 +211,10 @@ sub _search { > push @value, $self->{'search_form'}; > } > >- if ( $thesaurus ) { >+ # FIXME we don't have a method for negative search >+ # but 'notspecified' should be 'not n' - the best >+ # we can achieve currently is to ignore the thesaurus >+ if ( $thesaurus && $thesaurus ne 'notspecified' ) { > push @marclist, 'thesaurus'; > push @and_or, 'and'; > push @excluding, ''; >diff --git a/t/db_dependent/Heading.t b/t/db_dependent/Heading.t >index 0df92e51db..aa39c4f767 100755 >--- a/t/db_dependent/Heading.t >+++ b/t/db_dependent/Heading.t >@@ -65,7 +65,7 @@ subtest "UNIMARC tests" => sub { > > subtest "_search tests" => sub { > >- plan tests => 7; >+ plan tests => 8; > > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch'); >@@ -111,6 +111,15 @@ subtest "_search tests" => sub { > ]; > is_deeply( $terms, $expected_terms, "Search formed as expected with second indicator 7 and subfield 2"); > >+ $field = MARC::Field->new( '650', ' ', '4', a => 'Uncles', x => 'Fiction' ); >+ $heading = C4::Heading->new_from_field($field); >+ ($search_query) = $heading->_search( 'match-heading' ); >+ $terms = $search_query->{query}->{bool}->{must}; >+ $expected_terms = [ >+ { term => { 'match-heading.ci_raw' => 'Uncles generalsubdiv Fiction' } }, >+ ]; >+ is_deeply( $terms, $expected_terms, "Search doesn't specify thesaurus when heading marked as 'notspecified'"); >+ > $field = MARC::Field->new( '100', ' ', '', a => 'Yankovic, Al', d => '1959-,' ); > $heading = C4::Heading->new_from_field($field); > ($search_query) = $heading->_search( 'match-heading' ); >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33277
:
148417
|
148418
|
148419
|
148492
|
148493
|
148494
|
148495
|
148500
|
148527
|
148528
|
148529
|
148530
|
148531
|
148734
|
148735
|
148957
|
149837
|
149838
|
149839
|
149840
|
149841
|
149842
|
150890
|
150891
|
150977
|
150978
|
150979
|
150980
|
150981
|
150982
|
150983