Bug 26957: Don't remove words that are also operators from search terms
authorNick Clemens <nick@bywatersolutions.com>
Mon, 23 Nov 2020 18:37:48 +0000 (18:37 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 18 Jan 2021 14:32:00 +0000 (15:32 +0100)
commit680fc0f77d9c7c3c20dacc14c9db94b52d009ee4
tree0a55886ac0b3e3959c87a2c7593365696e080f03
parentb99770e5b5bae85a9b6bb76be7c2b253ae7ef61f
Bug 26957: Don't remove words that are also operators from search terms

FindDuplicate has a hardcoded regex to remove 'and', 'or', and 'not' from any search fields, however,
is does this with no regard for these terms being embedded in the middle of a word or phrase.

E.g.:
'Coupland' becomes 'Coupl'
'Frog and toad' becomes 'frog toad'
etc.

This patch simplay removes the substitutions as we already quote the terms as well

To test:
1 - Add records to your system like:
    The night circus by Erin Morgenstern
    Frog and toad all year
    Nothing ever happens
2 - Attempt to add purchase suggestions like
    title: the night circus, author:Morgenstern, Erin
    title: For and toad all year
    title:nothing ever happens (case is important)
3 - No warnings about existing biblios
4 - Apply patches
5 - Delete existing suggestions
6 - Repeat step 2
7 - Each attempt should warn you of existing biblio

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a52a9d787544aae384aee1a33c9d3bb35d98f8fa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Search.pm