Bug 20458 - Improper substitution of QUERY_KW in opac/opac-search.pl
Summary: Improper substitution of QUERY_KW in opac/opac-search.pl
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-21 16:15 UTC by Barton Chittenden
Modified: 2018-03-21 16:50 UTC (History)
0 users

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barton Chittenden 2018-03-21 16:15:44 UTC
If the system preference OPACNoResultsFound is enabled, all occurrences of the string {QUERY_KW} should be replaced with the query string if the query returns no results.

In opac/opac-search.pl, the regular expression that we're using to remove the keywords 'and' and 'or' isn't properly grouped:

(my $query_kw=$query_desc)=~s/ and|or / /g;

will replace ' and' or 'or '; this should be

(my $query_kw=$query_desc)=~s/ (and|or) / /g;

To reproduce:

Put "{QUERY_KW}" into

OPACNoResultsFound

Then do an opac search for

soy andina

or

tractor trailer

as long as neither of these is actually found, OPACNoResultsFound will show

soy ina

or

tract trailer
Comment 1 Barton Chittenden 2018-03-21 16:50:21 UTC
We should probably do a case insensitive search:

(my $query_kw=$query_desc)=~s/ (and|or) / /gi;