@@ -, +, @@ --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -199,13 +199,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 @@ -540,7 +540,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-/) { @@ -548,7 +548,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}; @@ -716,7 +716,6 @@ to ensure those parts are correct. sub _clean_search_term { my ( $self, $term ) = @_; - my $auto_truncation = C4::Context->preference("QueryAutoTruncate") || 0; # Some hardcoded searches (like with authorities) produce things like --