Browse Source

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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Marcel de Rooy 4 years ago
committed by Jonathan Druart
parent
commit
501b9ea336
  1. 18
      C4/Biblio.pm
  2. 12
      Koha/SearchEngine/Zebra/Indexer.pm

18
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({

12
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 );
}
}

Loading…
Cancel
Save