View | Details | Raw Unified | Return to bug 22046
Collapse All | Expand All

(-)a/C4/Matcher.pm (-19 / +9 lines)
Lines 675-695 sub get_matches { Link Here
675
                warn "search failed ($query) $error";
675
                warn "search failed ($query) $error";
676
            }
676
            }
677
            else {
677
            else {
678
                if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
678
                foreach my $matched ( @{$searchresults} ) {
679
                    foreach my $matched ( @{$searchresults} ) {
679
                    my $target_record = C4::Search::new_record_from_zebra( 'biblioserver', $matched );
680
                        my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", $marcframework_used );
680
                    my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", $marcframework_used );
681
                        my $id = ( $biblionumber_tag > 10 ) ?
681
                    my $id = ( $biblionumber_tag > 10 ) ?
682
                            $matched->field($biblionumber_tag)->subfield($biblionumber_subfield) :
682
                        $target_record->field($biblionumber_tag)->subfield($biblionumber_subfield) :
683
                            $matched->field($biblionumber_tag)->data();
683
                        $target_record->field($biblionumber_tag)->data();
684
                        $matches->{$id}->{score} += $matchpoint->{score};
684
                    $matches->{$id}->{score} += $matchpoint->{score};
685
                        $matches->{$id}->{record} = $matched;
685
                    $matches->{$id}->{record} = $target_record;
686
                    }
687
                }
688
                else {
689
                    foreach my $matched ( @{$searchresults} ) {
690
                        $matches->{$matched}->{score} += $matchpoint->{'score'};
691
                        $matches->{$matched}->{record} = $matched;
692
                    }
693
                }
686
                }
694
            }
687
            }
695
688
Lines 741-750 sub get_matches { Link Here
741
        };
734
        };
742
735
743
        foreach my $id ( keys %$matches ) {
736
        foreach my $id ( keys %$matches ) {
744
            my $target_record = C4::Search::new_record_from_zebra( 'biblioserver', $matches->{$id}->{record} );
745
            my $result = C4::Biblio::TransformMarcToKoha( $target_record, $marcframework_used );
746
            push @results, {
737
            push @results, {
747
                record_id => $result->{biblionumber},
738
                record_id => $id,
748
                score     => $matches->{$id}->{score}
739
                score     => $matches->{$id}->{score}
749
            };
740
            };
750
        }
741
        }
751
- 

Return to bug 22046