@@ -, +, @@ --- .../prog/en/modules/admin/preferences/opac.pref | 1 + opac/opac-search.pl | 8 ++++++++ 2 files changed, 9 insertions(+) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -204,6 +204,7 @@ OPAC: - a library select pulldown menu on the OPAC masthead. - - 'Display this HTML when no results are found for a search in the OPAC:' + - '
Note: The placeholder {QUERY_KW} will be replaced with the keywords of the query.' - pref: OPACNoResultsFound type: textarea class: code --- a/opac/opac-search.pl +++ a/opac/opac-search.pl @@ -736,6 +736,7 @@ for (my $i=0;$i<@servers;$i++) { $template->param(next_page_offset => $next_page_offset) unless $pages eq $current_page_number; } # no hits + # extracting keywords in case of relaunching search else { $template->param( searchdesc => 1, @@ -744,6 +745,13 @@ for (my $i=0;$i<@servers;$i++) { query_cgi => $query_cgi, limit_cgi => $limit_cgi ); + (my $query_kw=$query_desc)=~s/ and|or / /g; + my @query_kw=($query_kw=~ /([-\w]+\b)(?:[^,:]|$)/g); + $query_kw=join('+',@query_kw); + my $nohits=C4::Context->preference('OPACNoResultsFound'); + $nohits=~s/{QUERY_KW}/$query_kw/g; + $template->param( 'OPACNoResultsFound' =>$nohits); + $template->param(searchdesc => 1,query_desc => $query_desc,limit_desc => $limit_desc); } } # end of the if local # asynchronously search the authority server --