Bugzilla – Attachment 18231 Details for
Bug 10230
Match points do not work with authorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 10230: no need to use SimpleSearch for matching auths
PASSED-QA-Bug-10230-no-need-to-use-SimpleSearch-fo.patch (text/plain), 4.76 KB, created by
Katrin Fischer
on 2013-05-18 21:24:29 UTC
(
hide
)
Description:
[PASSED QA] Bug 10230: no need to use SimpleSearch for matching auths
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-05-18 21:24:29 UTC
Size:
4.76 KB
patch
obsolete
>From 6c7429e5dc9c0cd1dac00e490af48efd13277cc9 Mon Sep 17 00:00:00 2001 >From: Jared Camins-Esakov <jcamins@cpbibliography.com> >Date: Sat, 11 May 2013 10:40:09 -0400 >Subject: [PATCH] [PASSED QA] Bug 10230: no need to use SimpleSearch for > matching auths > >When introducing QueryParser, I introduced a check for QueryParser at >too high a level, causing authority matching to try and use SimpleSearch >for authorities prematurely, when SearchAuthorities should be handling >it. This patch corrects the level of the check. This patch only moves >three lines, but thanks to the change in if level, it adjusts the >indentation quite a bit. > >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Comments on third patch of this series. >--- > C4/Matcher.pm | 75 +++++++++++++++++++++++++++++++-------------------------- > 1 file changed, 41 insertions(+), 34 deletions(-) > >diff --git a/C4/Matcher.pm b/C4/Matcher.pm >index 6a7c4f2..4e064be 100644 >--- a/C4/Matcher.pm >+++ b/C4/Matcher.pm >@@ -628,51 +628,58 @@ sub get_matches { > > my $QParser; > $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser')); >- foreach my $matchpoint (@{ $self->{'matchpoints'} }) { >- my @source_keys = _get_match_keys($source_record, $matchpoint); >+ foreach my $matchpoint ( @{ $self->{'matchpoints'} } ) { >+ my @source_keys = _get_match_keys( $source_record, $matchpoint ); > next if scalar(@source_keys) == 0; >+ > # build query > my $query; > my $error; > my $searchresults; > my $total_hits; >- if ($QParser) { >- $query = join(" || ", map { "$matchpoint->{'index'}:$_" } @source_keys); >+ if ( $self->{'record_type'} eq 'biblio' ) { >+ if ($QParser) { >+ $query = join( " || ", >+ map { "$matchpoint->{'index'}:$_" } @source_keys ); >+ } >+ else { >+ $query = join( " or ", >+ map { "$matchpoint->{'index'}=$_" } @source_keys ); >+ } > require C4::Search; >- ($error, $searchresults, $total_hits) = C4::Search::SimpleSearch($query, 0, $max_matches, [ $self->{'record_type'} . 'server' ] ); >- } else { >- if ($self->{'record_type'} eq 'biblio') { >- $query = join(" or ", map { "$matchpoint->{'index'}=$_" } @source_keys); >- require C4::Search; >- ($error, $searchresults, $total_hits) = C4::Search::SimpleSearch($query, 0, $max_matches); >- } elsif ($self->{'record_type'} eq 'authority') { >- my $authresults; >- my @marclist; >- my @and_or; >- my @excluding = []; >- my @operator; >- my @value; >- foreach my $key (@source_keys) { >- push @marclist, $matchpoint->{'index'}; >- push @and_or, 'or'; >- push @operator, 'exact'; >- push @value, $key; >- } >- require C4::AuthoritiesMarc; >- ($authresults, $total_hits) = C4::AuthoritiesMarc::SearchAuthorities( >- \@marclist, \@and_or, \@excluding, \@operator, >- \@value, 0, 20, undef, 'AuthidAsc', 1 >- ); >- foreach my $result (@$authresults) { >- push @$searchresults, $result->{'authid'}; >- } >+ ( $error, $searchresults, $total_hits ) = >+ C4::Search::SimpleSearch( $query, 0, $max_matches ); >+ } >+ elsif ( $self->{'record_type'} eq 'authority' ) { >+ my $authresults; >+ my @marclist; >+ my @and_or; >+ my @excluding = []; >+ my @operator; >+ my @value; >+ foreach my $key (@source_keys) { >+ push @marclist, $matchpoint->{'index'}; >+ push @and_or, 'or'; >+ push @operator, 'exact'; >+ push @value, $key; >+ } >+ require C4::AuthoritiesMarc; >+ ( $authresults, $total_hits ) = >+ C4::AuthoritiesMarc::SearchAuthorities( >+ \@marclist, \@and_or, \@excluding, \@operator, >+ \@value, 0, 20, undef, >+ 'AuthidAsc', 1 >+ ); >+ foreach my $result (@$authresults) { >+ push @$searchresults, $result->{'authid'}; > } > } > >- if (defined $error ) { >+ if ( defined $error ) { > warn "search failed ($query) $error"; >- } else { >- foreach my $matched (@{$searchresults}) { >+ } >+ else { >+ foreach my $matched ( @{$searchresults} ) { > $matches{$matched} += $matchpoint->{'score'}; > } > } >-- >1.7.9.5
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 10230
:
18101
|
18102
|
18103
| 18231 |
18232
|
18233