@@ -, +, @@ process Matching rule code: TEST 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: None 2a) Default framework 2b) 024 $a http://koha-community.org/test $2 uri 2c) 040 $c test 2d) 245 $a This is a test record 2e) 942 $c Books 2f) Save (save again if cautioned about missing fields as these should autofill) 5a) Upload your .marc file. 5b) Change your "Record matching rule" to "Test" 5c) Click Stage for import --- C4/Matcher.pm | 6 ++++-- C4/Search.pm | 9 +++++---- Koha/SearchEngine/Elasticsearch/Search.pm | 6 +++++- 3 files changed, 14 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 ); } @@ -662,7 +664,7 @@ sub get_matches { my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); ( $error, $searchresults, $total_hits ) = - $searcher->simple_search_compat( $query, 0, $max_matches ); + $searcher->simple_search_compat( $query, 0, $max_matches, undef, skip_normalize => 1 ); } elsif ( $self->{'record_type'} eq 'authority' ) { my $authresults; --- a/C4/Search.pm +++ a/C4/Search.pm @@ -160,7 +160,7 @@ sub FindDuplicate { =head2 SimpleSearch -( $error, $results, $total_hits ) = SimpleSearch( $query, $offset, $max_results, [@servers] ); +( $error, $results, $total_hits ) = SimpleSearch( $query, $offset, $max_results, [@servers], [%options] ); This function provides a simple search API on the bibliographic catalog @@ -172,6 +172,7 @@ This function provides a simple search API on the bibliographic catalog * @servers is optional. Defaults to biblioserver as found in koha-conf.xml * $offset - If present, represents the number of records at the beginning to omit. Defaults to 0 * $max_results - if present, determines the maximum number of records to fetch. undef is All. defaults to undef. + * %options is optional. (e.g. "skip_normalize" allows you to skip changing : to = ) =item C @@ -221,7 +222,7 @@ $template->param(result=>\@results); =cut sub SimpleSearch { - my ( $query, $offset, $max_results, $servers ) = @_; + my ( $query, $offset, $max_results, $servers, %options ) = @_; return ( 'No query entered', undef, undef ) unless $query; # FIXME hardcoded value. See catalog/search.pl & opac-search.pl too. @@ -243,12 +244,12 @@ sub SimpleSearch { eval { $zconns[$i] = C4::Context->Zconn( $servers[$i], 1 ); if ($QParser) { - $query =~ s/=/:/g; + $query =~ s/=/:/g unless $options{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 $options{skip_normalize}; $zoom_queries[$i] = new ZOOM::Query::CCL2RPN( $query, $zconns[$i]); } $tmpresults[$i] = $zconns[$i]->search( $zoom_queries[$i] ); --- a/Koha/SearchEngine/Elasticsearch/Search.pm +++ a/Koha/SearchEngine/Elasticsearch/Search.pm @@ -269,7 +269,7 @@ sub count_auth_use { =head2 simple_search_compat my ( $error, $marcresults, $total_hits ) = - $searcher->simple_search( $query, $offset, $max_results ); + $searcher->simple_search( $query, $offset, $max_results, %options ); This is a simpler interface to the searching, intended to be similar enough to L. @@ -292,6 +292,10 @@ How many results to skip from the start of the results. The max number of results to return. The default is 100 (because unlimited is a pretty terrible thing to do.) +=item C<%options> + +These options are unused by Elasticsearch + =back Returns: --