Bugzilla – Attachment 168040 Details for
Bug 35125
AutoCreateAuthorities creates separate authorities when thesaurus differs, even with LinkerConsiderThesaurus set to Don't
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35125: Don't use thesaurus value in cache when LinkerConsiderThesaurus is set to don't
Bug-35125-Dont-use-thesaurus-value-in-cache-when-L.patch (text/plain), 4.75 KB, created by
Nick Clemens (kidclamp)
on 2024-06-24 20:04:45 UTC
(
hide
)
Description:
Bug 35125: Don't use thesaurus value in cache when LinkerConsiderThesaurus is set to don't
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-06-24 20:04:45 UTC
Size:
4.75 KB
patch
obsolete
>From d367be31fbbf2a43e1003fb8c4b9736722191a8c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 24 Jun 2024 19:53:42 +0000 >Subject: [PATCH] Bug 35125: Don't use thesaurus value in cache when > LinkerConsiderThesaurus is set to don't > >This patch adds a new key 'notconsidered' to the authority cache when linking to avoid doubling when creating new authorities and wishing to ignore thesaurus > >To test: >0 - Set LinkerConsiderThesaurus to "don't" >1 - Set AutCreateAuthorities to generate >2 - Set AutLinkBiblios to Do >3 - Set CataloguingModuleRelink to Do >4 - Save a new record in Koha with the same radnomized heading repeated but from 3 different authority sources > ensure source is defined by indicators only and by field $2 once > ensure the heading is random so that no matches will be found >5 - Confirm each authority is linked to a new unique authority >6 - Apply patch, restart all >7 - Repeat 4 with a new subject heading >8 - Confirm all headings are linked to the same authority >--- > C4/Linker/Default.pm | 1 + > t/db_dependent/Linker_Default.t | 20 +++++++++++++++++++- > 2 files changed, 20 insertions(+), 1 deletion(-) > >diff --git a/C4/Linker/Default.pm b/C4/Linker/Default.pm >index 9ce64fd5d0f..d34e916610e 100644 >--- a/C4/Linker/Default.pm >+++ b/C4/Linker/Default.pm >@@ -31,6 +31,7 @@ sub get_link { > my $search_form = $heading->search_form(); > my $auth_type = $heading->auth_type(); > my $thesaurus = $heading->{thesaurus} || 'notdefined'; >+ $thesaurus = 'notconsidered' unless C4::Context->preference('LinkerConsiderThesaurus'); > my $authid; > my $fuzzy = 0; > my $match_count; >diff --git a/t/db_dependent/Linker_Default.t b/t/db_dependent/Linker_Default.t >index 7e6aadccac0..d08e33e9325 100755 >--- a/t/db_dependent/Linker_Default.t >+++ b/t/db_dependent/Linker_Default.t >@@ -42,7 +42,7 @@ my $schema = $builder->schema(); > $schema->storage->txn_begin; > > subtest 'Test caching in get_link and update_cache' => sub { >- plan tests => 13; >+ plan tests => 16; > > my @tags = C4::Context->preference('marcflavour') eq 'UNIMARC' ? (601,'j',602,'a') : (650,'a',655,'a'); > >@@ -53,6 +53,8 @@ subtest 'Test caching in get_link and update_cache' => sub { > my $subject_field5 = MARC::Field->new($tags[0],0,7,$tags[1]=>'Science fiction','2'=>'sao'); > my $subject_field6 = MARC::Field->new($tags[0],0,7,$tags[1]=>'Science fiction','2'=>'sao'); > my $subject_field7 = MARC::Field->new($tags[0],0,4,$tags[1]=>'Science fiction'); >+ my $subject_field8 = MARC::Field->new($tags[0],0,7,$tags[1]=>'Science fiction','2'=>'oth'); >+ my $subject_field9 = MARC::Field->new($tags[0],0,3,$tags[1]=>'Science fiction'); > my $genre_field = MARC::Field->new($tags[2],0,2,$tags[3]=>'Science fiction'); > # Can we build a heading from it? > my $subject_heading = C4::Heading->new_from_field( $subject_field, q{} ); >@@ -62,8 +64,11 @@ subtest 'Test caching in get_link and update_cache' => sub { > my $subject_heading5 = C4::Heading->new_from_field( $subject_field5, q{} ); > my $subject_heading6 = C4::Heading->new_from_field( $subject_field6, q{} ); > my $subject_heading7 = C4::Heading->new_from_field( $subject_field7, q{} ); >+ my $subject_heading8 = C4::Heading->new_from_field( $subject_field8, q{} ); >+ my $subject_heading9 = C4::Heading->new_from_field( $subject_field9, q{} ); > my $genre_heading = C4::Heading->new_from_field( $genre_field, q{} ); > >+ t::lib::Mocks::mock_preference('LinkerConsiderThesaurus',1); > > # Now test to see if C4::Linker can find it. > my $linker = C4::Linker::Default->new(); >@@ -92,6 +97,19 @@ subtest 'Test caching in get_link and update_cache' => sub { > $linker->get_link($subject_heading7); > is( keys %{$linker->{cache}},6, "Eighth (matching) term added to cache because of thesaurus source not specified (2nd indicator is 4)"); > >+ t::lib::Mocks::mock_preference('LinkerConsiderThesaurus',0); >+ >+ $linker->get_link($subject_heading); >+ is( keys %{$linker->{cache}},7, "First term added to cache because cache key now has 'notconsidered' for thesaurus"); >+ >+ $linker->get_link($subject_heading8); >+ is( keys %{$linker->{cache}},7, "Ninth (matching) term not added to cache because thesaurus differs but is not considered"); >+ >+ $linker->get_link($subject_heading9); >+ is( keys %{$linker->{cache}},7, "Tenth (matching) term not added to cache because thesaurus differs but is not considered"); >+ >+ t::lib::Mocks::mock_preference('LinkerConsiderThesaurus',1); >+ > $linker->update_cache($subject_heading,32); > is( $linker->{cache}->{$subject_heading->search_form.$subject_heading->auth_type.$subject_heading->{'thesaurus'}}->{authid}, 32, "Linker cache is correctly updated by 'update_cache'"); > my ( $authid, undef ) = $linker->get_link($subject_heading); >-- >2.39.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 35125
:
168040
|
168047
|
168078
|
168096
|
168097
|
168261
|
168262