+
+ if ( defined $error ) {
+ 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;
+ }
+ }
+ }
+