Bug 25882: Remove phr indicator from limits when processing

We assume all limits from advanced search to be a phrase and quote them
when doing this we should remove the phrase marker to avoid doulbe quoting

To test:
 1 - Have koha using ES
 2 - Go to advanced search
 3 - Limit by a single itemtype that exists
 4 - Get some results
 5 - Limit by a different itemtype that exists
 6 - Get some results
 7 - Limit by both itemtypes
 8 - Get only the results for the second itemtype
 9 - Enable DumpTemplateVarsIntranet and DumpSearchQueryTemplate
10 - Repeat search
11 - View page source and find 'search_query'
12 - See limit looks like itype:("("BK")" OR "("CR")")
13 - Apply patches
14 - Restart all the things
15 - Repeat search for both itemtypes
16 - Note results now include both types

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a2b2426de8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 455acf686d)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
This commit is contained in:
Nick Clemens 2020-06-26 13:19:47 +00:00 committed by Aleisha Amohia
parent 2cd1258b28
commit 0c736919a7
1 changed files with 1 additions and 0 deletions

View File

@ -1014,6 +1014,7 @@ sub _fix_limit_special_cases {
}
else {
my ( $field, $term ) = $l =~ /^\s*([\w,-]*?):(.*)/;
$field =~ s/,phr$//; #We are quoting all the limits as phrase, this prevents from quoting again later
if ( defined($field) && defined($term) ) {
push @new_lim, "$field:(\"$term\")";
}