Summary: | Quotation marks in series fields (490/830) break XSLT search links in Elasticsearch | ||
---|---|---|---|
Product: | Koha | Reporter: | Slava Shishkin <slavashishkin> |
Component: | Staff interface | Assignee: | Bugs List <koha-bugs> |
Status: | Needs Signoff --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | bernard.scaife, gmcharlt |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Attachments: |
Bug 40569: Escape quotation marks in series fields in XSLT search links
Bug 40569: Escape quotation marks in series fields in XSLT search links (Elasticsearch) |
Description
Slava Shishkin
2025-07-31 17:41:44 UTC
Created attachment 184944 [details] [review] Bug 40569: Escape quotation marks in series fields in XSLT search links 1. Create or edit a bibliographic record (beter more then one) 2. In field 490$a or 830$a, enter a series name with quotes, e.g. Test "Series" 3. Save the record 4. On the detail page, click the Series link (generated from the XSLT view)Series: Test "Series" 5. The search fails or returns an error due to malformed query 6. Apply the patch 7. Reload the bibliographic detail page 8. Click the Series link again 9. The search should return matching records Strangely this works fine for me without any fix using test plan. 25.06.00.002 using Chrome 138.0.7204.184. Maybe different browsers are less forgiving? Rendered url that results is cgi-bin/koha/catalogue/search.pl?q=se,phr:%22Test%20%22Series%22%22 Thanks, Bernard, for checking! My apologies, I forgot to mention that this only happens when SearchEngine = Elasticsearch — with Zebra, it works fine. The issue is not browser-specific. Without escaping, the generated ES query contains raw quotes: se,phr:"Test "Series"" In this case, Koha returns in the browser: No results found No results match your search for '"se,phr:"Test "Series"""'. With the patch, quotes are escaped, and the query becomes: se,phr:"Test \"Series\"" Created attachment 185309 [details] [review] Bug 40569: Escape quotation marks in series fields in XSLT search links (Elasticsearch) 1. Choose Elasticsearch like Search engine: cgi-bin/koha/admin/preferences.pl?op=search&searchfield=SearchEngine 2. Create or edit a bibliographic record (beter more then one) 3. In field 490$a or 830$a, enter a series name with quotes, e.g. Test "Series" 4. Save the record 5. On the detail page, click the Series link (generated from the XSLT view)Series: Test "Series" 6. The search fails or returns an error due to malformed query 7. Apply the patch 8. Reload the bibliographic detail page 9. Click the Series link again 10. The search should return matching records Hi Slava, I replicated it this time with elastic :) Your patch works fine! Does it also need to be on line 490 of MARC21slimUtils.xsl which also has se,phr ? Also it would be great to add to the OPAC xslt too where I think we have the same issue. /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl lines are 381, 406, 454 and 505. thanks Bernard |