Bugzilla – Attachment 89058 Details for
Bug 22046
Simplify C4::Matcher->get_matches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22046: Simplify and unify the code for get_matches
Bug-22046-Simplify-and-unify-the-code-for-getmatch.patch (text/plain), 3.05 KB, created by
Liz Rea
on 2019-04-30 00:35:28 UTC
(
hide
)
Description:
Bug 22046: Simplify and unify the code for get_matches
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2019-04-30 00:35:28 UTC
Size:
3.05 KB
patch
obsolete
>From 4e77deb63be41f75df59402424c0e330a6189126 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 24 Dec 2018 12:52:53 +0000 >Subject: [PATCH] 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> >--- > C4/Matcher.pm | 27 +++++++++------------------ > 1 file changed, 9 insertions(+), 18 deletions(-) > >diff --git a/C4/Matcher.pm b/C4/Matcher.pm >index dc848048c1..9da4ce3faa 100644 >--- a/C4/Matcher.pm >+++ b/C4/Matcher.pm >@@ -675,21 +675,14 @@ sub get_matches { > warn "search failed ($query) $error"; > } > else { >- if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) { >- foreach my $matched ( @{$searchresults} ) { >- my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", $marcframework_used ); >- my $id = ( $biblionumber_tag > 10 ) ? >- $matched->field($biblionumber_tag)->subfield($biblionumber_subfield) : >- $matched->field($biblionumber_tag)->data(); >- $matches->{$id}->{score} += $matchpoint->{score}; >- $matches->{$id}->{record} = $matched; >- } >- } >- else { >- foreach my $matched ( @{$searchresults} ) { >- $matches->{$matched}->{score} += $matchpoint->{'score'}; >- $matches->{$matched}->{record} = $matched; >- } >+ foreach my $matched ( @{$searchresults} ) { >+ my $target_record = C4::Search::new_record_from_zebra( 'biblioserver', $matched ); >+ my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", $marcframework_used ); >+ my $id = ( $biblionumber_tag > 10 ) ? >+ $target_record->field($biblionumber_tag)->subfield($biblionumber_subfield) : >+ $target_record->field($biblionumber_tag)->data(); >+ $matches->{$id}->{score} += $matchpoint->{score}; >+ $matches->{$id}->{record} = $target_record; > } > } > >@@ -741,10 +734,8 @@ sub get_matches { > }; > > foreach my $id ( keys %$matches ) { >- my $target_record = C4::Search::new_record_from_zebra( 'biblioserver', $matches->{$id}->{record} ); >- my $result = C4::Biblio::TransformMarcToKoha( $target_record, $marcframework_used ); > push @results, { >- record_id => $result->{biblionumber}, >+ record_id => $id, > score => $matches->{$id}->{score} > }; > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22046
:
83475
|
89058
|
90017