diff --git a/catalogue/search.pl b/catalogue/search.pl index a162737303..2c172d5675 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -556,7 +556,8 @@ if ( $@ || $error ) { } my $hits = $results_hashref->{$server}->{"hits"} // 0; -if ( $hits == 0 && $basic_search ) { +if ( $hits == 0 && $basic_search && $operands[0] !~ /^\".*\"$/ ) { + my $og_query = $query_desc; $operands[0] = '"' . $operands[0] . '"'; #quote it ## I. BUILD THE QUERY ( @@ -585,6 +586,10 @@ if ( $hits == 0 && $basic_search ) { }; my $quoted_hits = $quoted_results_hashref->{$server}->{"hits"} // 0; if ($quoted_hits) { + $template->param( + quoted_hits => 1, + og_query => $og_query, + ); $results_hashref->{$server} = $quoted_results_hashref->{$server}; $hits = $quoted_hits; } 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 2fa9cd06da..2e0e720bb9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -72,6 +72,12 @@

Search results

[% IF ( total ) %] + [% IF quoted_hits %] +

+ No result(s) found for your original query: [% og_query %]
+ Your search was retried, quoted +

+ [% END %]

[% total | html %] result(s) found [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF limit_desc %]