@@ -, +, @@ process Description: Test Match threshold: 100 Record type: Bibliographic Match point 1: Search index: id-other,st-urx Score: 100 Tag: 024 Subfields: a Normalization rule: raw --- C4/Matcher.pm | 14 ++++++++++---- C4/Search.pm | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) --- a/C4/Matcher.pm +++ a/C4/Matcher.pm @@ -649,7 +649,9 @@ sub get_matches { my $total_hits; if ( $self->{'record_type'} eq 'biblio' ) { - if ($QParser) { + #NOTE: The QueryParser can't handle the CCL syntax of 'qualifier','qualifier', so fallback to non-QueryParser. + #NOTE: You can see this in C4::Search::SimpleSearch() as well in a different way. + if ($QParser && $matchpoint->{'index'} !~ m/\w,\w/) { $query = join( " || ", map { "$matchpoint->{'index'}:$_" } @source_keys ); } @@ -660,9 +662,8 @@ sub get_matches { } require C4::Search; - ( $error, $searchresults, $total_hits ) = - C4::Search::SimpleSearch( $query, 0, $max_matches ); + C4::Search::SimpleSearch( $query, 0, $max_matches, undef, "skip_normalize" ); } elsif ( $self->{'record_type'} eq 'authority' ) { my $authresults; @@ -822,7 +823,12 @@ sub _get_match_keys { } elsif ($component->{'offset'}) { $string= substr($string, $component->{'offset'}); } - $key = _normalize($string); + $key = $string; + my $norms = $component->{'norms'}; + my $normalizer = $norms->[0]; #Matching rules, currently, can only have one normalizer. It will always be defined, even if it's only as ''. + if ($normalizer !~ /(none|raw)/i){ + $key = _normalize($string); + } if ($i == 0) { push @keys, $key if $key; } else { --- a/C4/Search.pm +++ a/C4/Search.pm @@ -221,7 +221,7 @@ $template->param(result=>\@results); =cut sub SimpleSearch { - my ( $query, $offset, $max_results, $servers ) = @_; + my ( $query, $offset, $max_results, $servers, $skip_normalize ) = @_; return ( 'No query entered', undef, undef ) unless $query; # FIXME hardcoded value. See catalog/search.pl & opac-search.pl too. @@ -243,12 +243,12 @@ sub SimpleSearch { eval { $zconns[$i] = C4::Context->Zconn( $servers[$i], 1 ); if ($QParser) { - $query =~ s/=/:/g; + $query =~ s/=/:/g unless $skip_normalize; $QParser->parse( $query ); $query = $QParser->target_syntax($servers[$i]); $zoom_queries[$i] = new ZOOM::Query::PQF( $query, $zconns[$i]); } else { - $query =~ s/:/=/g; + $query =~ s/:/=/g unless $skip_normalize; $zoom_queries[$i] = new ZOOM::Query::CCL2RPN( $query, $zconns[$i]); } $tmpresults[$i] = $zconns[$i]->search( $zoom_queries[$i] ); --