Bug 22046

Summary: Simplify C4::Matcher->get_matches
Product: Koha Reporter: Nick Clemens <nick>
Component: Architecture, internals, and plumbingAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: dcook, katrin.fischer, m.de.rooy, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 24348    
Attachments: Bug 22046: Simplify and unify the code for get_matches
Bug 22046: Simplify and unify the code for get_matches
Bug 22046: Simplify and unify the code for get_matches

Description Nick Clemens 2018-12-24 12:52:44 UTC
Currently we process things separately for ES and Zebra

For ES we get the results:
get the biblionumber field using GetMarcFromKohaField
extract the biblionumber from the record, save as id
store the record in a hash like:
$matches->{$id}->{record} = $matched

For zebra:
we use the xml record from zebra $matched as the id
store it in a hash like
$matches->{$id}->{record} = $matched
$id and $matched are both the full xml of the record

For both:
We then convert the record into a Marc::Record
Call C4::Biblio::TransformMarcToKoha - this gets all the koha fields
Use only the biblionumber to return results


It would be simpler to follow the ES pattern for both and avoid the TranformMarcToKoha call
Comment 1 Nick Clemens 2018-12-24 12:58:44 UTC
Created attachment 83475 [details] [review]
Bug 22046: Simplify and unify the code for get_matches

To test:
1 - Stage some records for import
2 - Manage the records
3 - Use several different matching rules and note the results
4 - Apply patch
5 - Try several matching rules again and note the results have not
changed
6 - Try under both search engines (Zebra and ES)
Comment 2 David Cook 2019-01-02 07:22:16 UTC
I haven't looked at the patch but might be worth keeping in mind https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17710.
Comment 3 Nick Clemens 2019-01-02 15:46:21 UTC
(In reply to David Cook from comment #2)
> I haven't looked at the patch but might be worth keeping in mind
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17710.

I don't think it should have any effect here - this simply removes a conditional on SearchEngine setting so that the matcher code is the same in either scenario (the check does still happen, but in a subroutine, this removes a second check)
Comment 4 Liz Rea 2019-04-30 00:35:28 UTC
Created attachment 89058 [details] [review]
Bug 22046: Simplify and unify the code for get_matches

To test:
1 - Stage some records for import
2 - Manage the records
3 - Use several different matching rules and note the results
4 - Apply patch
5 - Try several matching rules again and note the results have not
changed
6 - Try under both search engines (Zebra and ES)

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 5 Marcel de Rooy 2019-05-23 09:07:09 UTC
Created attachment 90017 [details] [review]
Bug 22046: Simplify and unify the code for get_matches

To test:
1 - Stage some records for import
2 - Manage the records
3 - Use several different matching rules and note the results
4 - Apply patch
5 - Try several matching rules again and note the results have not
changed
6 - Try under both search engines (Zebra and ES)

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Marcel de Rooy 2019-05-23 09:07:58 UTC
Code looks good to me. Tests would be even more convincing ;)
Comment 7 Nick Clemens 2019-05-23 15:01:51 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-05-30 19:44:52 UTC
I'm not going to backport this architectural enhancement to 18.11.x series at this time.