Bugzilla – Attachment 186761 Details for
Bug 40856
Improve Standard backend metadata retrieval
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40856: Optimize Standard backend metadata method with database-level filtering
Bug-40856-Optimize-Standard-backend-metadata-metho.patch (text/plain), 2.38 KB, created by
Martin Renvoize (ashimema)
on 2025-09-22 20:56:49 UTC
(
hide
)
Description:
Bug 40856: Optimize Standard backend metadata method with database-level filtering
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-09-22 20:56:49 UTC
Size:
2.38 KB
patch
obsolete
>From a547364d8697ea72868d9ed5514435bd304e8b6a Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= <tomascohen@theke.io> >Date: Mon, 22 Sep 2025 16:24:54 -0300 >Subject: [PATCH] Bug 40856: Optimize Standard backend metadata method with > database-level filtering > >This patch optimizes the metadata() method in the Standard ILL backend >to use database-level filtering instead of inefficient linear searches. > >Performance improvement: >- Before: Load all attributes, then filter each with linear search >- After: Load only relevant attributes using database index > >Test plan: >1. Apply patch >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/ILL/Backend/Standard.t >=> SUCCESS: Tests pass! Optimization maintains compatibility >3. Test ILL request metadata display: > - View ILL request details > - Verify metadata shows correctly > - Check ignored fields are excluded >=> SUCCESS: Same functionality, better performance >4. Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > Koha/ILL/Backend/Standard.pm | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > >diff --git a/Koha/ILL/Backend/Standard.pm b/Koha/ILL/Backend/Standard.pm >index 4aaff4641db..65f332b86ba 100644 >--- a/Koha/ILL/Backend/Standard.pm >+++ b/Koha/ILL/Backend/Standard.pm >@@ -145,21 +145,24 @@ that we do not consider to be metadata > > sub metadata { > my ( $self, $request ) = @_; >- my $attrs = $request->extended_attributes; >- my $metadata = {}; >- my @ignore = ( >+ >+ my @ignore = ( > 'requested_partners', 'type', 'type_disclaimer_value', 'type_disclaimer_date', 'unauthenticated_first_name', > 'unauthenticated_last_name', 'unauthenticated_email', 'historycheck_requests', 'copyrightclearance_confirmed' > ); >+ >+ # Use database-level filtering instead of manual iteration >+ my $attrs = $request->extended_attributes->search( { type => { '-not_in' => \@ignore } } ); >+ > my $core_fields = _get_core_fields(); >+ my $metadata = {}; >+ > while ( my $attr = $attrs->next ) { > my $type = $attr->type; >- if ( !grep { $_ eq $type } @ignore ) { >- my $name; >- $name = $core_fields->{$type} || ucfirst($type); >- $metadata->{$name} = $attr->value; >- } >+ my $name = $core_fields->{$type} || ucfirst($type); >+ $metadata->{$name} = $attr->value; > } >+ > return $metadata; > } > >-- >2.51.0
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 40856
:
186742
|
186743
|
186760
| 186761