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

(-)a/C4/Matcher.pm (-2 / +4 lines)
Lines 649-655 sub get_matches { Link Here
649
        my $total_hits;
649
        my $total_hits;
650
        if ( $self->{'record_type'} eq 'biblio' ) {
650
        if ( $self->{'record_type'} eq 'biblio' ) {
651
651
652
            if ($QParser) {
652
            #NOTE: The QueryParser can't handle the CCL syntax of 'qualifier','qualifier', so fallback to non-QueryParser.
653
            #NOTE: You can see this in C4::Search::SimpleSearch() as well in a different way.
654
            if ($QParser && $matchpoint->{'index'} !~ m/\w,\w/) {
653
                $query = join( " || ",
655
                $query = join( " || ",
654
                    map { "$matchpoint->{'index'}:$_" } @source_keys );
656
                    map { "$matchpoint->{'index'}:$_" } @source_keys );
655
            }
657
            }
Lines 662-668 sub get_matches { Link Here
662
664
663
            my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
665
            my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
664
            ( $error, $searchresults, $total_hits ) =
666
            ( $error, $searchresults, $total_hits ) =
665
              $searcher->simple_search_compat( $query, 0, $max_matches );
667
              $searcher->simple_search_compat( $query, 0, $max_matches, undef, skip_normalize => 1 );
666
        }
668
        }
667
        elsif ( $self->{'record_type'} eq 'authority' ) {
669
        elsif ( $self->{'record_type'} eq 'authority' ) {
668
            my $authresults;
670
            my $authresults;
(-)a/C4/Search.pm (-4 / +5 lines)
Lines 160-166 sub FindDuplicate { Link Here
160
160
161
=head2 SimpleSearch
161
=head2 SimpleSearch
162
162
163
( $error, $results, $total_hits ) = SimpleSearch( $query, $offset, $max_results, [@servers] );
163
( $error, $results, $total_hits ) = SimpleSearch( $query, $offset, $max_results, [@servers], [%options] );
164
164
165
This function provides a simple search API on the bibliographic catalog
165
This function provides a simple search API on the bibliographic catalog
166
166
Lines 172-177 This function provides a simple search API on the bibliographic catalog Link Here
172
    * @servers is optional. Defaults to biblioserver as found in koha-conf.xml
172
    * @servers is optional. Defaults to biblioserver as found in koha-conf.xml
173
    * $offset - If present, represents the number of records at the beginning to omit. Defaults to 0
173
    * $offset - If present, represents the number of records at the beginning to omit. Defaults to 0
174
    * $max_results - if present, determines the maximum number of records to fetch. undef is All. defaults to undef.
174
    * $max_results - if present, determines the maximum number of records to fetch. undef is All. defaults to undef.
175
    * %options is optional. (e.g. "skip_normalize" allows you to skip changing : to = )
175
176
176
177
177
=item C<Return:>
178
=item C<Return:>
Lines 221-227 $template->param(result=>\@results); Link Here
221
=cut
222
=cut
222
223
223
sub SimpleSearch {
224
sub SimpleSearch {
224
    my ( $query, $offset, $max_results, $servers )  = @_;
225
    my ( $query, $offset, $max_results, $servers, %options )  = @_;
225
226
226
    return ( 'No query entered', undef, undef ) unless $query;
227
    return ( 'No query entered', undef, undef ) unless $query;
227
    # FIXME hardcoded value. See catalog/search.pl & opac-search.pl too.
228
    # FIXME hardcoded value. See catalog/search.pl & opac-search.pl too.
Lines 243-254 sub SimpleSearch { Link Here
243
        eval {
244
        eval {
244
            $zconns[$i] = C4::Context->Zconn( $servers[$i], 1 );
245
            $zconns[$i] = C4::Context->Zconn( $servers[$i], 1 );
245
            if ($QParser) {
246
            if ($QParser) {
246
                $query =~ s/=/:/g;
247
                $query =~ s/=/:/g unless $options{skip_normalize};
247
                $QParser->parse( $query );
248
                $QParser->parse( $query );
248
                $query = $QParser->target_syntax($servers[$i]);
249
                $query = $QParser->target_syntax($servers[$i]);
249
                $zoom_queries[$i] = new ZOOM::Query::PQF( $query, $zconns[$i]);
250
                $zoom_queries[$i] = new ZOOM::Query::PQF( $query, $zconns[$i]);
250
            } else {
251
            } else {
251
                $query =~ s/:/=/g;
252
                $query =~ s/:/=/g unless $options{skip_normalize};
252
                $zoom_queries[$i] = new ZOOM::Query::CCL2RPN( $query, $zconns[$i]);
253
                $zoom_queries[$i] = new ZOOM::Query::CCL2RPN( $query, $zconns[$i]);
253
            }
254
            }
254
            $tmpresults[$i] = $zconns[$i]->search( $zoom_queries[$i] );
255
            $tmpresults[$i] = $zconns[$i]->search( $zoom_queries[$i] );
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (-2 / +5 lines)
Lines 269-275 sub count_auth_use { Link Here
269
=head2 simple_search_compat
269
=head2 simple_search_compat
270
270
271
    my ( $error, $marcresults, $total_hits ) =
271
    my ( $error, $marcresults, $total_hits ) =
272
      $searcher->simple_search( $query, $offset, $max_results );
272
      $searcher->simple_search( $query, $offset, $max_results, %options );
273
273
274
This is a simpler interface to the searching, intended to be similar enough to
274
This is a simpler interface to the searching, intended to be similar enough to
275
L<C4::Search::SimpleSearch>.
275
L<C4::Search::SimpleSearch>.
Lines 292-297 How many results to skip from the start of the results. Link Here
292
The max number of results to return. The default is 100 (because unlimited
292
The max number of results to return. The default is 100 (because unlimited
293
is a pretty terrible thing to do.)
293
is a pretty terrible thing to do.)
294
294
295
=item C<%options>
296
297
These options are unused by Elasticsearch
298
295
=back
299
=back
296
300
297
Returns:
301
Returns:
298
- 

Return to bug 15541