Bug 30153 - FindDuplicate ElasticSearch should not use lowercase 'and'
Summary: FindDuplicate ElasticSearch should not use lowercase 'and'
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 27928
Blocks:
  Show dependency treegraph
 
Reported: 2022-02-22 14:08 UTC by Thomas Klausner
Modified: 2022-03-21 00:16 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.04,21.05.13


Attachments
Use uppercase AND to join query parts (1.89 KB, patch)
2022-02-22 14:20 UTC, Thomas Klausner
Details | Diff | Splinter Review
Bug 30153: Use uppercase AND to join query parts (1.95 KB, patch)
2022-02-22 14:39 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30153: (QA follow-up) Fix unit tests (1.04 KB, patch)
2022-02-22 16:28 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Klausner 2022-02-22 14:08:32 UTC
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').
Comment 1 Thomas Klausner 2022-02-22 14:10:57 UTC
See Also 27928
Comment 2 Thomas Klausner 2022-02-22 14:20:17 UTC
Created attachment 131014 [details] [review]
Use uppercase AND to join query parts

Fix Bug 30153
Comment 3 Martin Renvoize 2022-02-22 14:39:38 UTC
Created attachment 131016 [details] [review]
Bug 30153: Use uppercase AND to join query parts

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 <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2022-02-22 14:40:22 UTC
I tested against Zebra and found no obvious regressions, ES issue is resolved... Signing off.
Comment 5 Martin Renvoize 2022-02-22 16:26:07 UTC
This a trivial patch, and given I've just QA'd bug 25616 now it's been brought to my attention, I'm going to go ahead and QA this one too.

Unit test update inbound, then it'll be a pass.
Comment 6 Martin Renvoize 2022-02-22 16:28:50 UTC
Created attachment 131023 [details] [review]
Bug 30153: (QA follow-up) Fix unit tests
Comment 7 Fridolin Somers 2022-03-02 08:49:19 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 8 Kyle M Hall 2022-03-04 13:19:50 UTC
Pushed to 21.11.x for 21.11.04
Comment 9 Andrew Fuerste-Henry 2022-03-20 15:06:41 UTC
Pushed to 21.05.x for 21.05.13
Comment 10 Victor Grousset/tuxayo 2022-03-21 00:16:42 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.