Bug 39076: Use state variable to avoid creating extra ES connections
As elsewhere in the code, we should use a state variable for our
'bib_searcher' object to avoid overhead of extra ES connections.
Worth noting - we don't actually use the 'bib_searcher' at all during
record auto linking as we pass skipmetadata
To test:
0 - Apply patch
1 - Enable biblio auto linking
AutoLinkBiblios, CatalogModuleRelink, LinkerRelink
2 - Stage and import a marc file
3 - Confirm record authorities link as expected
4 - Search authorities in the staff interface
5 - Confirm usage counts are shown for results
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e2207cb478)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
d31f8d7279
commit
e2a3710b7d
|
|
@ -214,7 +214,8 @@ sub search_auth_compat {
|
|||
my $schema = $database->schema();
|
||||
my $res = $self->search($query, undef, $count, %options);
|
||||
|
||||
my $bib_searcher = Koha::SearchEngine::Elasticsearch::Search->new({index => 'biblios'});
|
||||
# Use state variables to avoid recreating the objects every time.
|
||||
state $bib_searcher = Koha::SearchEngine::Elasticsearch::Search->new( { index => 'biblios' } );
|
||||
my @records;
|
||||
my $hits = $res->{'hits'};
|
||||
foreach my $es_record (@{$hits->{'hits'}}) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue