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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-4 / +3 lines)
Lines 198-210 sub build_query_compat { Link Here
198
    my ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan,
198
    my ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan,
199
        $lang, $params )
199
        $lang, $params )
200
      = @_;
200
      = @_;
201
202
#die Dumper ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan, $lang );
201
#die Dumper ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan, $lang );
203
    my @sort_params  = $self->_convert_sort_fields(@$sort_by);
202
    my @sort_params  = $self->_convert_sort_fields(@$sort_by);
204
    my @index_params = $self->_convert_index_fields(@$indexes);
203
    my @index_params = $self->_convert_index_fields(@$indexes);
205
    my $limits       = $self->_fix_limit_special_cases($orig_limits);
204
    my $limits       = $self->_fix_limit_special_cases($orig_limits);
206
    if ( $params->{suppress} ) { push @$limits, "suppress:0"; }
205
    if ( $params->{suppress} ) { push @$limits, "suppress:0"; }
207
206
207
208
    # Merge the indexes in with the search terms and the operands so that
208
    # Merge the indexes in with the search terms and the operands so that
209
    # each search thing is a handy unit.
209
    # each search thing is a handy unit.
210
    unshift @$operators, undef;    # The first one can't have an op
210
    unshift @$operators, undef;    # The first one can't have an op
Lines 543-549 sub _convert_index_fields { Link Here
543
    # If a field starts with mc- we save it as it's used (and removed) later
543
    # If a field starts with mc- we save it as it's used (and removed) later
544
    # when joining things, to indicate we make it an 'OR' join.
544
    # when joining things, to indicate we make it an 'OR' join.
545
    # (Sorry, this got a bit ugly after special cases were found.)
545
    # (Sorry, this got a bit ugly after special cases were found.)
546
    grep { $_->{field} } map {
546
    map {
547
        my ( $f, $t ) = split /,/;
547
        my ( $f, $t ) = split /,/;
548
        my $mc = '';
548
        my $mc = '';
549
        if ($f =~ /^mc-/) {
549
        if ($f =~ /^mc-/) {
Lines 551-557 sub _convert_index_fields { Link Here
551
            $f =~ s/^mc-//;
551
            $f =~ s/^mc-//;
552
        }
552
        }
553
        my $r = {
553
        my $r = {
554
            field => $index_field_convert{$f},
554
            field => $index_field_convert{$f} // $f,
555
            type  => $index_type_convert{ $t // '__default' }
555
            type  => $index_type_convert{ $t // '__default' }
556
        };
556
        };
557
        $r->{field} = ($mc . $r->{field}) if $mc && $r->{field};
557
        $r->{field} = ($mc . $r->{field}) if $mc && $r->{field};
558
- 

Return to bug 18163