Bug 28676: Cache and retrieve match_count when searching a cached heading

We use match_count to determine if a new authority record should be created, however,
we were not adding this count to the cache, so if a record returned too many matches on first
lookup, we would create a new record on the second lookup

To test:
1 - Set Linker Module to 'Default'
2 - Enable  AutoCreateAuthorities  and  BiblioAddsAuthorities and  CatalogModuleRelink and LinkerRelink
3 - Add two copies of a single authority via Z39
4 - Add two headings for that authority to a bib record (e.g. a 610 and 710)
5 - Save the record and note a new authority is generated
6 - Repeat and see another is generated
7 - Apply patch
8 - Restart all the things
9 - Save the record again, no new authority created

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit c46cefb7c5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9d5150e4cd)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit 848ac85dcc)
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit 848ac85dcc)
This commit is contained in:
Nick Clemens 2021-07-07 15:39:43 +00:00 committed by Wainui Witika-Park
parent 5c04f569a9
commit 8d687b2ea8
1 changed files with 2 additions and 0 deletions

View File

@ -38,6 +38,7 @@ sub get_link {
if ( $self->{'cache'}->{$search_form.$auth_type}->{'cached'} ) {
$authid = $self->{'cache'}->{$search_form.$auth_type}->{'authid'};
$fuzzy = $self->{'cache'}->{$search_form.$auth_type}->{'fuzzy'};
$match_count = $self->{'cache'}->{$search_form.$auth_type}->{'match_count'};
}
else {
@ -78,6 +79,7 @@ sub get_link {
$self->{'cache'}->{$search_form.$auth_type}->{'cached'} = 1;
$self->{'cache'}->{$search_form.$auth_type}->{'authid'} = $authid;
$self->{'cache'}->{$search_form.$auth_type}->{'fuzzy'} = $fuzzy;
$self->{'cache'}->{$search_form.$auth_type}->{'match_count'} = $match_count;
}
return $self->SUPER::_handle_auth_limit($authid), $fuzzy, $match_count;
}