From 2acd533f1752301f2d75e02db08bb72220a092c8 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 30 Sep 2020 12:52:28 +0000 Subject: [PATCH] Bug 26578: Clean overdrive searches before passing to OD This patch copies regex used in buildQuery to detect ccl code in queries, but here we adapt it to remove any ccl signifiers to ensure correct results from OD To test: 1 - Have OverDrive enabled and configured 2 - set UseAuthoritiesForTracings to "Don't use" 3 - Search in the catalog for a record 4 - From the details page for a record click on an author link 5 - Note the query in catalog is like 'au:"Whitford, Bradley."' 6 - Some overdrive catalogs will return records matching 'au:' 7 - Apply patch 8 - Reload the page, if spurious results now, they should be gone 9 - Perform a search that returns overdrive results 10 - For a title in overdrive search koha with: au:{Author} AND ti:{Title} 11 - Confirm overdrive results are returned 12 - Check the link to overdrive results and note query section is: q=Author AND Title --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index e67f3d815c..75725ba1d2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -915,6 +915,8 @@ var $overdrive_results = $( '
' + MSG_SEARCHING.format('OverDrive') + '
' ); $( '#numresults' ) .append( ' ' ) .append( $overdrive_results ); + //Clean querystring + od_querystring = querystring.replace(/(?:^|\W)([\w-]+)(,[\w-]+)*([:=])/g,' '); KOHA.OverDrive.Search( "[% Koha.Preference('OverDriveLibraryID') | html %]", querystring, 1, 0, function( data ) { if ( data.error ) { $overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') ); -- 2.11.0