Bug 27928

Summary: FindDuplicate is hardcoded to use Zebra
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: SearchingAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew, dcook, fridolin.somers, kyle, martin.renvoize, victor
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24562
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.05,20.05.11
Circulation function:
Bug Depends on:    
Bug Blocks: 30153    
Attachments: Bug 27928: FindDuplicate shuold use simple_search_compat
Bug 27928: FindDuplicate shuold use simple_search_compat
Bug 27928: FindDuplicate shuold use simple_search_compat

Description Nick Clemens (kidclamp) 2021-03-11 13:34:32 UTC
There is a fixme in the code, we should use 'simple_search_compat'
Comment 1 Nick Clemens (kidclamp) 2021-03-11 13:41:42 UTC
Created attachment 118120 [details] [review]
Bug 27928: FindDuplicate shuold use simple_search_compat

This patch switches from calling SimpleSearch directly to using the compat
method so that Elastic is used when it is the chosen search engine

To test:
 1 - Set SearchEngine syspref to 'Zebra'
 2 - Add a suggestion with an existing title, e.g.:
   'E street shuffle'
 3 - Confirm you get a duplication warning
 4 - Change SearchEngine to ES
 5 - Repeat get same warning
 6 - sudo koha-zebra --stop
    'ps aux | grep zebra'  to confirm they are stoped
    'sudo pkill -9 zebra' if they arent;
 7 - Repeat suggestion - no duplication warning (because zebra returns nothing)
 8 - Delete the suggestion
 9 - Apply patches
10 - Restart all the things, stop zebra
11 - Repeat suggestion
12 - Successful warning from ES
13 - prove -v t/db_dependent/Search.t
Comment 2 Fridolin Somers 2021-03-22 10:24:54 UTC
Created attachment 118577 [details] [review]
Bug 27928: FindDuplicate shuold use simple_search_compat

This patch switches from calling SimpleSearch directly to using the compat
method so that Elastic is used when it is the chosen search engine

To test:
 1 - Set SearchEngine syspref to 'Zebra'
 2 - Add a suggestion with an existing title, e.g.:
   'E street shuffle'
 3 - Confirm you get a duplication warning
 4 - Change SearchEngine to ES
 5 - Repeat get same warning
 6 - sudo koha-zebra --stop
    'ps aux | grep zebra'  to confirm they are stoped
    'sudo pkill -9 zebra' if they arent;
 7 - Repeat suggestion - no duplication warning (because zebra returns nothing)
 8 - Delete the suggestion
 9 - Apply patches
10 - Restart all the things, stop zebra
11 - Repeat suggestion
12 - Successful warning from ES
13 - prove -v t/db_dependent/Search.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 3 Fridolin Somers 2021-03-22 10:25:55 UTC
Works perfect with both engines.
Comment 4 Martin Renvoize (ashimema) 2021-03-25 14:42:18 UTC
Created attachment 118816 [details] [review]
Bug 27928: FindDuplicate shuold use simple_search_compat

This patch switches from calling SimpleSearch directly to using the compat
method so that Elastic is used when it is the chosen search engine

To test:
 1 - Set SearchEngine syspref to 'Zebra'
 2 - Add a suggestion with an existing title, e.g.:
   'E street shuffle'
 3 - Confirm you get a duplication warning
 4 - Change SearchEngine to ES
 5 - Repeat get same warning
 6 - sudo koha-zebra --stop
    'ps aux | grep zebra'  to confirm they are stoped
    'sudo pkill -9 zebra' if they arent;
 7 - Repeat suggestion - no duplication warning (because zebra returns nothing)
 8 - Delete the suggestion
 9 - Apply patches
10 - Restart all the things, stop zebra
11 - Repeat suggestion
12 - Successful warning from ES
13 - prove -v t/db_dependent/Search.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize (ashimema) 2021-03-25 14:43:14 UTC
Clear and simple fix, works as expected, no regressions found.

Passing QA
Comment 6 Jonathan Druart 2021-04-01 16:54:40 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-04-13 14:53:10 UTC
Pushed to 20.11.x for 20.11.05
Comment 8 Andrew Fuerste-Henry 2021-04-24 13:55:24 UTC
Pushed to 20.05.x for 20.05.11
Comment 9 Victor Grousset/tuxayo 2021-04-24 16:50:27 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.
Comment 10 David Cook 2021-07-20 03:12:59 UTC
I think this may have inadvertently fixed Bug 24562.

In theory, the max results could be 1 instead of 50, since all the code that uses FindDuplicate only ever takes the 1st result, but I suppose you never know...