X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FMatcher.pm;h=d61964ce2037b0348582e9a96f09ab34871ec64f;hb=fcfe9b253a02d6c541eaa9dd3de0da96dc5fbde1;hp=5915c12ea3cbb3152d7dfff78f2ef0931798460d;hpb=f46abf8b909257a54c9e2c1fdd999ba30c7ac0ae;p=koha_gimpoz diff --git a/C4/Matcher.pm b/C4/Matcher.pm index 5915c12ea3..d61964ce20 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -95,6 +95,22 @@ sub GetMatcherList { return @results; } +=head2 GetMatcherId + + my $matcher_id = C4::Matcher::GetMatcherId($code); + +Returns the matcher_id of a code. + +=cut + +sub GetMatcherId { + my ($code) = @_; + my $dbh = C4::Context->dbh; + + my $matcher_id = $dbh->selectrow_array("SELECT matcher_id FROM marc_matchers WHERE code = ?", undef, $code); + return $matcher_id; +} + =head1 METHODS =head2 new @@ -606,9 +622,12 @@ sub get_matches { # FIXME only searching biblio index at the moment my ($error, $searchresults, $total_hits) = SimpleSearch($query, 0, $max_matches); - warn "search failed ($query) $error" if $error; - foreach my $matched (@$searchresults) { - $matches{$matched} += $matchpoint->{'score'}; + if (defined $error ) { + warn "search failed ($query) $error"; + } else { + foreach my $matched (@{$searchresults}) { + $matches{$matched} += $matchpoint->{'score'}; + } } }