[Koha-bugs] [Bug 22690] Merging records with many items too slow (Elasticsearch)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue May 12 19:40:05 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22690

--- Comment #40 from Josef Moravec <josef.moravec at gmail.com> ---
Comment on attachment 104797
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=104797
Bug 22690: Refactor merging of records to improve performance (Elasticsearch)

Review of attachment 104797:
 --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=22690&attachment=104797)
-----------------------------------------------------------------

Great job Ere, I have just few concerns about the code. But I like this
refactor a lot!

::: Koha/Item.pm
@@ +840,5 @@
> +
> +    my $schema = Koha::Database->new()->schema();
> +
> +    # Acquisition orders related to the item
> +    my $orders = $schema->resultset('Aqorder')->search(

Koha::Object(s) should be used

@@ +847,5 @@
> +    );
> +    $orders->update_all({ biblionumber => $biblionumber });
> +
> +    # reserves
> +    my $reserves = $self->_result->reserves;

there is $self->holds method

@@ +867,5 @@
> +            $dbh->do("UPDATE tmp_holdsqueue SET biblionumber=? WHERE itemnumber=?", undef, $biblionumber, $self->itemnumber);
> +        }
> +    );
> +    #my $tmp_holdsqueues = $self->_result->tmp_holdsqueues;
> +    #$tmp_holdsqueues->update_all({ biblionumber => $biblionumber });

Please, remove these commented lines

::: cataloguing/merge.pl
@@ +106,5 @@
>          UPDATE suggestions SET biblionumber = ? WHERE biblionumber = ?
>      ");
> +    my $sth_articlerequests = $dbh->prepare("
> +        UPDATE article_requests SET biblionumber = ? WHERE biblionumber = ?
> +    ");

There should be no SQL in .pl script. Please, use Koha::Object(s)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list