Bug 13442

Summary: Facet links broken when collection code limit is used
Product: Koha Reporter: Barton Chittenden <barton>
Component: SearchingAssignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: dcook, gwilliams, jdemuth, jonathan.druart, kyle, p.thrasher, tomascohen, veron
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23086
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 13442 - Facet links broken when collection code limit is used
[Signed-off] Bug 13442 - Facet links broken when collection code limit is used
[PASSED QA] Bug 13442 - Facet links broken when collection code limit is used

Description Barton Chittenden 2014-12-11 15:51:04 UTC
Clicking on a collection code facet generates a broken URL.

For example on the Bywater demo server  http://intranet.bywatersolutions.com
(username: bywater, password bywater)

Step 1) Keyword search for 'Juggling': http://intranet.bywatersolutions.com/cgi-bin/koha/catalogue/search.pl?idx=kw&q=juggling&op=and&idx=kw&q=&op=and&idx=kw&q=&limit-yr=&limit=&limit=&limit=&limit=&limit=&limit=&multibranchlimit=&sort_by=relevance

Step 2) Click on Author 'De Paola, Tomie' in record 5. "The clown of God : an old story" (Popular author, likely to have useful search facets). This takes us to http://intranet.bywatersolutions.com/cgi-bin/koha/catalogue/search.pl?q=au:%22De%20Paola,%20Tomie.%22

Step 3) Click facet for item type "Adult Office" => http://intranet.bywatersolutions.com/cgi-bin/koha/catalogue/search.pl?q=ccl=au%3A

This is equivalent to 

http://intranet.bywatersolutions.com/cgi-bin/koha/catalogue/search.pl?q=ccl=au:

Which obviously won't return any results.
Comment 1 Kyle M Hall (khall) 2014-12-11 16:54:35 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2014-12-19 17:17:19 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2014-12-19 20:34:51 UTC
Created attachment 34602 [details] [review]
[PASSED QA] Bug 13442 - Facet links broken when collection code limit is used

Any search limits including a ccode will break the search facts.

Test Plan:
1) Run an advanced search using a ccode limit
2) Try using any of the facet links of the left
3) Note they are broken
4) Apply this patch
5) Refresh the results
6) Note the facet links are no longer broken

Note: I have not been able to reproduce this issue on my own test
system, but have noted the problem on at least a dozen Koha servers.

I could not reproduce the bug either, but I saw it on the Bywater Demo (comment #1).
Applied patch and tested facets, no problems found, signing off
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Can not reproduce the problem, but I can also not find a regression.
Comment 4 Jonathan Druart 2014-12-23 15:16:15 UTC
Does this work if the facet contain a simple quote?
Comment 5 Barton Chittenden 2015-03-09 20:00:59 UTC
Shelf location facets are breaking in exactly the same way. Does C4::Search::buildQuery need to be refactored?

Bug 13812 - Facet links broken when shelf location limit is used.
Comment 6 Tomás Cohen Arazi (tcohen) 2015-03-19 17:17:11 UTC
Does this target master? the 3.18.x branch? UTf-8 handling differs, a lot on each.
Comment 7 Tomás Cohen Arazi (tcohen) 2015-03-19 17:58:39 UTC
(In reply to Tomás Cohen Arazi from comment #6)
> Does this target master? the 3.18.x branch? UTf-8 handling differs, a lot on
> each.

Sorry, wrong but number :-D

Kyle, could you please address Jonathan's concern?
Comment 8 Barton Chittenden 2015-04-16 23:05:37 UTC
The double-quoted "ccode" URLs are being passed to the search results page /cgi-bin/koha/catalogue/detail.pl and breaking the "Return to results" link on that page.
Comment 9 Kyle M Hall (khall) 2015-04-20 13:13:51 UTC
(In reply to Tomás Cohen Arazi from comment #6)
> Does this target master? the 3.18.x branch? UTf-8 handling differs, a lot on
> each.

Yes, this targets master. As far as I know this isn't a UTF-8 related issue, but deals with quotes.
Comment 10 David Cook 2015-04-21 01:51:14 UTC
I can't reproduce this in master.

Search:
http://intranet.bywatersolutions.com/cgi-bin/koha/catalogue/search.pl?q=au:%22De%20Paola,%20Tomie.%22

Creates:
<a href="/cgi-bin/koha/catalogue/search.pl?q=ccl=au%3A" de%20paola%2c%20tomie."&amp;limit="itype:AOF&quot;" title="AOF">Adult Office</a>

However...

Search:
http://192.168.1.61:2112/cgi-bin/koha/catalogue/search.pl?q=au:%22De%20Paola,%20Tomie%22

Creates:
<a href="/cgi-bin/koha/catalogue/search.pl?q=ccl=au%3A%22De%20Paola%2C%20Tomie%22&amp;sort_by=relevance_dsc&amp;limit=itype:TEST" title="TEST">test</a>

Which works just fine.

I noticed the Bywater site is on 3.19.00.016, and I'm on 3.19.00.026, so maybe that makes a difference. Or perhaps there's a setting difference somewhere... but this is the same thing I noticed on http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812. The Bywater link has an extra space and all the letters are lowercased.
Comment 11 Tomás Cohen Arazi (tcohen) 2015-04-30 19:48:24 UTC
Patch pushed to master.

Thanks Kyle!
Comment 12 David Cook 2019-02-15 01:29:04 UTC
I think this patch caused a regression which I've noted in #22344
Comment 13 David Cook 2019-02-15 01:29:23 UTC
(In reply to David Cook from comment #12)
> I think this patch caused a regression which I've noted in #22344

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22344