Bugzilla – Attachment 166066 Details for
Bug 14007
Values listed in OpacHiddenItems should not appear in OPAC facets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14007: Reduce lookups
Bug-14007-Reduce-lookups.patch (text/plain), 2.38 KB, created by
Nick Clemens (kidclamp)
on 2024-05-02 12:13:59 UTC
(
hide
)
Description:
Bug 14007: Reduce lookups
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-05-02 12:13:59 UTC
Size:
2.38 KB
patch
obsolete
>From 42b1fefe9155b37254c11f34497e114c492a02e7 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 2 May 2024 12:13:26 +0000 >Subject: [PATCH] Bug 14007: Reduce lookups > >--- > C4/Search.pm | 14 +++++--------- > Koha/SearchEngine/Elasticsearch/Search.pm | 4 ++-- > 2 files changed, 7 insertions(+), 11 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 7de39a68a5f..661a17ae3da 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -621,15 +621,11 @@ sub GetFacets { > } > > if ( C4::Context->interface eq 'opac' ) { >- for my $k ( keys %$facets ) { >- if ( $k eq 'itype' ) { >- my $itemtypes = Koha::ItemTypes->new; >- for my $fv ( keys %{ $facets->{$k} } ) { >- my $itemtype = $itemtypes->find($fv); >- if ( defined $itemtype && $itemtype->hideinopac ) { >- delete $facets->{$k}->{$fv}; >- } >- } >+ my @itype_facets = keys %{ $facets->{'itype'} }; >+ if( @itype_facets ){ >+ my $hidden_itemtypes = Koha::ItemTypes->search({ hideinopac => 1 }); >+ while( my $hi = $hidden_itemtypes->next ){ >+ delete $facets->{'itype'}->{$hi->itemtype}; > } > } > } >diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm >index 772b844fb1f..d70a6df7a67 100644 >--- a/Koha/SearchEngine/Elasticsearch/Search.pm >+++ b/Koha/SearchEngine/Elasticsearch/Search.pm >@@ -459,7 +459,7 @@ sub _convert_facets { > homebranch => $library_names > ); > >- my @hidden_itemtypes = map { $_->itemtype } ( grep { $opac && $_->hideinopac } @itypes ); >+ my %hidden_itemtypes = map { $_->itemtype => 1 } ( grep { $opac && $_->hideinopac } @itypes ); > > my @facets; > $exp_facet //= ''; >@@ -481,7 +481,7 @@ sub _convert_facets { > next unless length($t); # FIXME Currently we cannot search for an empty faceted field i.e. ln:"" to find records missing languages, though ES does count them correctly > my $c = $term->{doc_count}; > my $label; >- next if $type eq 'itype' && grep { $_ eq $t } @hidden_itemtypes; >+ next if $type eq 'itype' && $hidden_itemtypes{ $t }; > if ( exists( $special{$type} ) ) { > $label = $special{$type}->{$t} // $t; > } >-- >2.39.2
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 14007
:
79233
|
164978
|
166030
|
166066
|
173243
|
173309
|
173365