Bug 22046 - Simplify C4::Matcher->get_matches
Summary: Simplify C4::Matcher->get_matches
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-24 12:52 UTC by Nick Clemens
Modified: 2019-05-30 19:44 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 22046: Simplify and unify the code for get_matches (3.01 KB, patch)
2018-12-24 12:58 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 22046: Simplify and unify the code for get_matches (3.05 KB, patch)
2019-04-30 00:35 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 22046: Simplify and unify the code for get_matches (3.15 KB, patch)
2019-05-23 09:07 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.