Bug 28241: Fix regex to allow for content before and after comma

1. Set up the OPACNoResultsFound with the {QUERY_KW} placeholder.
2.Do a search with a comma that will return no results. Like "King, Martin Luther". If the returns results add some additional characters to the search until no results are returns.
3. Look at the #noresultsfound HTML element. Anything before (or after) the comma is omitted. So the placeholder looks something like 'Martin Luther' instead of 'King, Martin Luther'.
4. Apply patch
5. Try the search again, you should see the content before and after a comma

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 685fcb1880)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8bc4e05918)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2021-04-27 21:23:55 +00:00 committed by Andrew Fuerste-Henry
parent ef685c7a5e
commit d06db33ac5
1 changed files with 1 additions and 1 deletions

View File

@ -958,7 +958,7 @@ for (my $i=0;$i<@servers;$i++) {
if ($nohits and $nohits=~/{QUERY_KW}/){
# extracting keywords in case of relaunching search
(my $query_kw=$query_desc)=~s/ and|or / /g;
my @query_kw=($query_kw=~ /([-\w]+\b)(?:[^,:]|$)/g);
my @query_kw=($query_kw=~ /([-\w]+\b)(?:[^:]|$)/g);
$query_kw=join('+',@query_kw);
$nohits=~s/{QUERY_KW}/$query_kw/g;
$template->param('OPACNoResultsFound' =>$nohits);