Bugzilla – Attachment 176168 Details for
Bug 38832
Dead code in catalogue/search.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38832: Remove authority search from catalogue/search
Bug-38832-Remove-authority-search-from-cataloguese.patch (text/plain), 6.99 KB, created by
David Cook
on 2025-01-06 23:42:37 UTC
(
hide
)
Description:
Bug 38832: Remove authority search from catalogue/search
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-01-06 23:42:37 UTC
Size:
6.99 KB
patch
obsolete
>From c34cf16044cbcbd2d3a748892b9836d7c7c78201 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 6 Jan 2025 16:04:55 +0100 >Subject: [PATCH] Bug 38832: Remove authority search from catalogue/search > >This one is less obvious, how is it possible to request an authority >search using catalogue/search.pl? > >Is it dead code or is it actually used somewhere? > >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > catalogue/search.pl | 44 ++----------------- > .../prog/en/modules/catalogue/results.tt | 22 ---------- > 2 files changed, 4 insertions(+), 62 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 14e6279f61..7ce2edf0b5 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -358,13 +358,6 @@ foreach my $sort (@sort_by) { > } > $template->param('sort_by' => $sort_by[0]); > >-# Use the servers defined, or just search our local catalog(default) >-my @servers = $cgi->multi_param('server'); >-unless (@servers) { >- #FIXME: this should be handled using Context.pm >- @servers = ("biblioserver"); >- # @servers = C4::Context->config("biblioserver"); >-} > # operators include boolean and proximity operators and are used > # to evaluate multiple operands > my @operators = map uri_unescape($_), $cgi->multi_param('op'); >@@ -523,10 +516,11 @@ my $total = 0; # the total results for the whole set > my $facets; # this object stores the faceted results that display on the left-hand of the results page > my $results_hashref; > >+my $server = 'biblioserver'; > eval { > my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; > ( $error, $results_hashref, $facets ) = $searcher->search_compat( >- $query, $simple_query, \@sort_by, \@servers, >+ $query, $simple_query, \@sort_by, [$server], > $results_per_page, $offset, undef, $itemtypes, > $query_type, $scan > ); >@@ -541,12 +535,6 @@ if ($@ || $error) { > exit; > } > >-# At this point, each server has given us a result set >-# now we build that set for template display >-my @sup_results_array; >-for (my $i=0;$i<@servers;$i++) { >- my $server = $servers[$i]; >- if ($server =~/biblioserver/) { # this is the local bibliographic server > my $hits = $results_hashref->{$server}->{"hits"} // 0; > if ( $hits == 0 && $basic_search ){ > $operands[0] = '"'.$operands[0].'"'; #quote it >@@ -562,14 +550,14 @@ for (my $i=0;$i<@servers;$i++) { > eval { > my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; > ( $error, $quoted_results_hashref, $facets ) = $searcher->search_compat( >- $query, $simple_query, \@sort_by, ['biblioserver'], >+ $query, $simple_query, \@sort_by, [$server], > $results_per_page, $offset, undef, $itemtypes, > $query_type, $scan > ); > }; > my $quoted_hits = $quoted_results_hashref->{$server}->{"hits"} // 0; > if ( $quoted_hits ){ >- $results_hashref->{'biblioserver'} = $quoted_results_hashref->{'biblioserver'}; >+ $results_hashref->{$server} = $quoted_results_hashref->{$server}; > $hits = $quoted_hits; > } > } >@@ -689,30 +677,6 @@ for (my $i=0;$i<@servers;$i++) { > $template->param(searchdesc => 1,query_desc => $query_desc,limit_desc => $limit_desc); > } > >- } # end of the if local >- >- # asynchronously search the authority server >- elsif ($server =~/authorityserver/) { # this is the local authority server >- my @inner_sup_results_array; >- for my $sup_record ( @{$results_hashref->{$server}->{"RECORDS"}} ) { >- my $marc_record_object = C4::Search::new_record_from_zebra( >- 'authorityserver', >- $sup_record >- ); >- # warn "Authority Found: ".$marc_record_object->as_formatted(); >- push @inner_sup_results_array, { >- 'title' => $marc_record_object->field(100)->subfield('a'), >- 'link' => "&idx=an&q=".$marc_record_object->field('001')->as_string(), >- }; >- } >- push @sup_results_array, { servername => $server, >- inner_sup_results_loop => \@inner_sup_results_array} if @inner_sup_results_array; >- } >- # FIXME: can add support for other targets as needed here >- $template->param( outer_sup_results_loop => \@sup_results_array); >-} #/end of the for loop >-#$template->param(FEDERATED_RESULTS => \@results_array); >- > my $gotonumber = $cgi->param('gotoNumber'); > if ( $gotonumber && ( $gotonumber eq 'last' || $gotonumber eq 'first' ) ) { > $template->{'VARS'}->{'gotoNumber'} = $gotonumber; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index ea7e79769b..c842b0b01d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -73,11 +73,6 @@ > > <h1>Search results</h1> > >- [% IF ( outer_sup_results_loop ) %] >- <div class="row"> >- <div class="col-sm-8"> >- [% END %] >- > [% IF ( total ) %] > > <h3> >@@ -722,23 +717,6 @@ > <!-- No Results Found --> > [% END #/IF total %] > >- [% IF ( outer_sup_results_loop ) %] >- </div> >- <div class="col-sm-4"> >- [% FOREACH outer_sup_results_loo IN outer_sup_results_loop %] >- [% IF ( outer_sup_results_loo.inner_sup_results_loop ) %] >- [% outer_sup_results_loo.servername | html %] >- [% FOREACH inner_sup_results_loo IN outer_sup_results_loo.inner_sup_results_loop %] >- <div> >- <a href="/cgi-bin/koha/catalogue/search.pl?[% inner_sup_results_loo.query_cgi | $raw %][% inner_sup_results_loo.limit_cgi | $raw %][% inner_sup_results_loo.sort_by | uri %][% inner_sup_results_loo.link | uri %]">[% inner_sup_results_loo.title | html %]</a> >- </div> >- [% END %] >- [% END %] >- [% END # FOREACH outer_sup_results_loo %] >- </div> <!-- /.col-sm-4 --> >- </div> >- [% END #/IF outer_sup_results_loop %] >- > [% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %] > <div id="search_filters_modal" class="modal" role="dialog" aria-hidden="true"> > <div class="modal-dialog"> >-- >2.39.5
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 38832
:
176151
|
176152
|
176167
|
176168
|
176169
|
176336
|
176337
|
176338