Bug 16483

Summary: Ampersand breaks search for analytics
Product: Koha Reporter: Magnus Enger <magnus>
Component: SearchingAssignee: Bugs List <koha-bugs>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: feli, katrin.fischer
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Magnus Enger 2016-05-09 20:09:37 UTC
A customer has reported the following problem:

A journal is catalogued with separate records for each issue. The journal has an ampersand in the title, let's call it "This & that". Each issue has 245$a like "This & that 2011-1", "This & that 2011-2" and so on. For each issue, there are analytical records. 

Now, when you are on the detail view of one of the issues in the staff client (<intranet>/cgi-bin/koha/catalogue/detail.pl?biblionumber=12657) and click on "Show analytics", you get results from all issues of the journal, not just the one you wanted. The URL you are taken to looks like this:

<intranet>/cgi-bin/koha/catalogue/search.pl?q=Host-item:This & that 2011-3.

Above the search results it says:

14 result(s) found for 'Host-item:This ' in MyLibrary Catalog.

Note that the title has been cut before the ampersand. 

It is possible to tweak the search URL (remove the ampersand) and get the expected results. Changing the URL to this:

<intranet>/cgi-bin/koha/catalogue/search.pl?q=Host-item:This that 2011-3.

gives this:

8 result(s) found for 'Host-item:This that 2011-3.' in MyLibrary Catalog.

The same thing happens in the OPAC. 

I guess a workaround will be to enable UseControlNumber and follow the descriptions here: https://wiki.koha-community.org/wiki/Analytics
Comment 1 Katrin Fischer 2020-01-11 12:46:04 UTC
I believe this to be fixed with the use of str:encode-uri in the XSLT files now.