From 501b9ea33667c7fdd87fe356b9fab364c10ab383 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 25 Sep 2020 07:02:56 +0000 Subject: [PATCH] Bug 25265: (QA follow-up) Rename biblionumber in ModZebra, index_records ModZebra: The name is very misleading: we can index authid's too here. And yes, it should not be in C4/Biblio too ;) A first step.. Adding the same change here in Koha/SearchEngine/Zebra/Indexer. Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- C4/Biblio.pm | 18 ++++++++---------- Koha/SearchEngine/Zebra/Indexer.pm | 12 ++++++------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index e6c973d1db..260535ea7c 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2489,20 +2489,19 @@ sub CountItemsIssued { =head2 ModZebra - ModZebra( $biblionumber, $op, $server, $record ); + ModZebra( $record_number, $op, $server, $record ); -$biblionumber is the biblionumber we want to index +$record_number is the authid or biblionumber we want to index -$op is specialUpdate or recordDelete, and is used to know what we want to do +$op is the operation: specialUpdate or recordDelete -$server is the server that we want to update +$server is authorityserver or biblioserver =cut sub ModZebra { -###Accepts a $server variable thus we can use it for biblios authorities or other zebra dbs - my ( $biblionumber, $op, $server ) = @_; - $debug && warn "ModZebra: updates requested for: $biblionumber $op $server\n"; + my ( $record_number, $op, $server ) = @_; + $debug && warn "ModZebra: updates requested for: $record_number $op $server\n"; my $dbh = C4::Context->dbh; # true ModZebra commented until indexdata fixes zebraDB crashes (it seems they occur on multiple updates @@ -2515,17 +2514,16 @@ sub ModZebra { AND operation = ? AND done = 0"; my $check_sth = $dbh->prepare_cached($check_sql); - $check_sth->execute( $server, $biblionumber, $op ); + $check_sth->execute( $server, $record_number, $op ); my ($count) = $check_sth->fetchrow_array; $check_sth->finish(); if ( $count == 0 ) { my $sth = $dbh->prepare("INSERT INTO zebraqueue (biblio_auth_number,server,operation) VALUES(?,?,?)"); - $sth->execute( $biblionumber, $server, $op ); + $sth->execute( $record_number, $server, $op ); $sth->finish; } } - =head2 EmbedItemsInMarcBiblio EmbedItemsInMarcBiblio({ diff --git a/Koha/SearchEngine/Zebra/Indexer.pm b/Koha/SearchEngine/Zebra/Indexer.pm index 29213dd8fc..8ead358d9e 100644 --- a/Koha/SearchEngine/Zebra/Indexer.pm +++ b/Koha/SearchEngine/Zebra/Indexer.pm @@ -28,7 +28,7 @@ Koha::SearchEngine::Elasticsearch::Indexer - handles adding new records to the i =head1 SYNOPSIS my $indexer = Koha::SearchEngine::Zebra::Indexer->new(); - $indexer->index_records( $biblionumbers, $op, $server, $records); + $indexer->index_records( $record_numbers, $op, $server, $records); =head1 FUNCTIONS @@ -45,7 +45,7 @@ sub new { my $self = $class->SUPER::new(@_); } -=head2 index_records($biblionumbers, $op, $server, $records) +=head2 index_records($record_numbers, $op, $server, $records) This is simply a wrapper to C4::Biblio::ModZebra that takes an array of records and passes them through individually @@ -55,10 +55,10 @@ sub new { =cut sub index_records { - my ( $self, $biblionumbers, $op, $server, $records ) = @_; - $biblionumbers = [$biblionumbers] if ref $biblionumbers ne 'ARRAY' && defined $biblionumbers; - foreach my $biblionumber ( @$biblionumbers ){ - ModZebra( $biblionumber, $op, $server ); + my ( $self, $record_numbers, $op, $server, $records ) = @_; + $record_numbers = [$record_numbers] if ref $record_numbers ne 'ARRAY' && defined $record_numbers; + foreach my $record_number ( @$record_numbers ){ + ModZebra( $record_number, $op, $server ); } } -- 2.39.5