@@ -, +, @@ --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -198,13 +198,13 @@ sub build_query_compat { my ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan, $lang, $params ) = @_; - #die Dumper ( $self, $operators, $operands, $indexes, $orig_limits, $sort_by, $scan, $lang ); my @sort_params = $self->_convert_sort_fields(@$sort_by); my @index_params = $self->_convert_index_fields(@$indexes); my $limits = $self->_fix_limit_special_cases($orig_limits); if ( $params->{suppress} ) { push @$limits, "suppress:0"; } + # Merge the indexes in with the search terms and the operands so that # each search thing is a handy unit. unshift @$operators, undef; # The first one can't have an op @@ -543,7 +543,7 @@ sub _convert_index_fields { # If a field starts with mc- we save it as it's used (and removed) later # when joining things, to indicate we make it an 'OR' join. # (Sorry, this got a bit ugly after special cases were found.) - grep { $_->{field} } map { + map { my ( $f, $t ) = split /,/; my $mc = ''; if ($f =~ /^mc-/) { @@ -551,7 +551,7 @@ sub _convert_index_fields { $f =~ s/^mc-//; } my $r = { - field => $index_field_convert{$f}, + field => $index_field_convert{$f} // $f, type => $index_type_convert{ $t // '__default' } }; $r->{field} = ($mc . $r->{field}) if $mc && $r->{field}; --