From 9ce8dccc45e0fcad39ee9c92eb6b29ee795612b5 Mon Sep 17 00:00:00 2001 From: Thomas Klausner Date: Tue, 22 Feb 2022 15:09:58 +0100 Subject: [PATCH] Bug 30153: Use uppercase AND to join query parts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit C4::Search->FindDuplicate joins title and author using 'and' (lowercase). When this query is passed on to ElasticSearch, it interprets the lowercase 'and' as a term to search for, because the operator has to be in uppercases ('AND'). Test plan: * Reproduce the bug: - Set SearchEngine to ElasticSearch (and make sure you have the data indexed etc) - Find an existing book, note the title (245a) and the author (100a) - Create a new book (Cataloging -> New Record) - Fill in the same title and author using the same data as in an existing book (and any other fields that might be required) - Click "save" => A new book will be created, the Duplicate Finder has failed * Apply the patch * Check if it's working now: - Create a new book (Cataloging -> New Record) - Fill in the same title and author using the same data as in an existing book (and any other fields that might be required) - Click "save" - The DuplicateFinder should now report the already exising book Maybe we should also check if Zebra does not have any problems with the uppercase 'AND'? In that case, repeat the above steps, but set SearchEngine to Zebra :-) Sponsored-by: Steiermärkische Landesbibliothek Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall (cherry picked from commit eebfe5005a74768ca8e1f628a0d9b8b84d135b63) Signed-off-by: Andrew Fuerste-Henry --- C4/Search.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index 5df6de6696..02a1ed2f98 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -98,7 +98,7 @@ sub FindDuplicate { my $titleindex = 'ti,ext'; my $authorindex = 'au,ext'; - my $op = 'and'; + my $op = 'AND'; $result->{title} =~ s /\\//g; $result->{title} =~ s /\"//g; -- 2.39.5