[Koha-bugs] [Bug 33554] searching borrowers is a lot slower if there's searchable extended attributes.

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Oct 10 11:25:37 CEST 2023


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

--- Comment #20 from Julian Maurice <julian.maurice at biblibre.com> ---
Comment on attachment 154331
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=154331
Bug 33554: [WIP] Add a new lookup endpoint for patron searching

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

::: Koha/Patrons.pm
@@ +93,5 @@
> +        }
> +        $attributes_rs = Koha::Patron::Attributes->search( { -and => \@attributes_query } );
> +    }
> +
> +    push @{ $query->{-or} }, { 'me.borrowernumber' => { -in => [ $attributes_rs->get_column('borrowernumber') ] } };

This will break if ExtendedPatronAttributes is disabled ($attributes_rs will be
undef)

Also, if no patron attributes are searchable,
`$attributes_rs->get_column('borrowernumber')` will return borrowernumbers of
all borrowers that have at least one attribute.

It's probably a good idea to use
`$attributes_rs->_resultset->get_column('borrowernumber')->as_query` instead in
order to not have to fetch all borrowernumbers first (not tested)

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


More information about the Koha-bugs mailing list