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
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)
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.
(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)
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>
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>
Code looks good to me. Tests would be even more convincing ;)
Awesome work all! Pushed to master for 19.05
I'm not going to backport this architectural enhancement to 18.11.x series at this time.