Bug 26578: Clean overdrive searches before passing to OD
authorNick Clemens <nick@bywatersolutions.com>
Wed, 30 Sep 2020 12:52:28 +0000 (12:52 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 1 Feb 2021 15:36:38 +0000 (16:36 +0100)
commit4a8b1b904eb05fec95834bcba0336e9d975f5d32
treead16c021aacc655d2a06016fc25caef3d14af1a9
parentae76d7626b0a23830b0269c00cbc2be73720d9ec
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:&quot;Whitford, Bradley.&quot;'
6 - Some overdrive catalogs will return records matching 'au:'
7 - Apply patch
8 - Reload the page, if there were spurious results before, they should now 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

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt