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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-5 / +3 lines)
Lines 199-211 sub build_query_compat { Link Here
199
    my ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan,
199
    my ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan,
200
        $lang, $params )
200
        $lang, $params )
201
      = @_;
201
      = @_;
202
203
#die Dumper ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan, $lang );
202
#die Dumper ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan, $lang );
204
    my @sort_params  = $self->_convert_sort_fields(@$sort_by);
203
    my @sort_params  = $self->_convert_sort_fields(@$sort_by);
205
    my @index_params = $self->_convert_index_fields(@$indexes);
204
    my @index_params = $self->_convert_index_fields(@$indexes);
206
    my $limits       = $self->_fix_limit_special_cases($orig_limits);
205
    my $limits       = $self->_fix_limit_special_cases($orig_limits);
207
    if ( $params->{suppress} ) { push @$limits, "suppress:0"; }
206
    if ( $params->{suppress} ) { push @$limits, "suppress:0"; }
208
207
208
209
    # Merge the indexes in with the search terms and the operands so that
209
    # Merge the indexes in with the search terms and the operands so that
210
    # each search thing is a handy unit.
210
    # each search thing is a handy unit.
211
    unshift @$operators, undef;    # The first one can't have an op
211
    unshift @$operators, undef;    # The first one can't have an op
Lines 540-546 sub _convert_index_fields { Link Here
540
    # If a field starts with mc- we save it as it's used (and removed) later
540
    # If a field starts with mc- we save it as it's used (and removed) later
541
    # when joining things, to indicate we make it an 'OR' join.
541
    # when joining things, to indicate we make it an 'OR' join.
542
    # (Sorry, this got a bit ugly after special cases were found.)
542
    # (Sorry, this got a bit ugly after special cases were found.)
543
    grep { $_->{field} } map {
543
    map {
544
        my ( $f, $t ) = split /,/;
544
        my ( $f, $t ) = split /,/;
545
        my $mc = '';
545
        my $mc = '';
546
        if ($f =~ /^mc-/) {
546
        if ($f =~ /^mc-/) {
Lines 548-554 sub _convert_index_fields { Link Here
548
            $f =~ s/^mc-//;
548
            $f =~ s/^mc-//;
549
        }
549
        }
550
        my $r = {
550
        my $r = {
551
            field => $index_field_convert{$f},
551
            field => $index_field_convert{$f} // $f,
552
            type  => $index_type_convert{ $t // '__default' }
552
            type  => $index_type_convert{ $t // '__default' }
553
        };
553
        };
554
        $r->{field} = ($mc . $r->{field}) if $mc && $r->{field};
554
        $r->{field} = ($mc . $r->{field}) if $mc && $r->{field};
Lines 716-722 to ensure those parts are correct. Link Here
716
716
717
sub _clean_search_term {
717
sub _clean_search_term {
718
    my ( $self, $term ) = @_;
718
    my ( $self, $term ) = @_;
719
720
    my $auto_truncation = C4::Context->preference("QueryAutoTruncate") || 0;
719
    my $auto_truncation = C4::Context->preference("QueryAutoTruncate") || 0;
721
720
722
    # Some hardcoded searches (like with authorities) produce things like
721
    # Some hardcoded searches (like with authorities) produce things like
723
- 

Return to bug 18163