Lines 285-291
sub build_authorities_query {
Link Here
|
285 |
|
285 |
|
286 |
foreach my $s ( @{ $search->{searches} } ) { |
286 |
foreach my $s ( @{ $search->{searches} } ) { |
287 |
my ( $wh, $op, $val ) = @{$s}{qw(where operator value)}; |
287 |
my ( $wh, $op, $val ) = @{$s}{qw(where operator value)}; |
288 |
if ( $op eq 'is' || $op eq '=' || $op eq 'exact') { |
288 |
if ( defined $op && ($op eq 'is' || $op eq '=' || $op eq 'exact') ) { |
289 |
if ($wh) { |
289 |
if ($wh) { |
290 |
# Match the whole field, case insensitive, UTF normalized. |
290 |
# Match the whole field, case insensitive, UTF normalized. |
291 |
push @query_parts, { term => { "$wh.ci_raw" => $val } }; |
291 |
push @query_parts, { term => { "$wh.ci_raw" => $val } }; |
Lines 304-310
sub build_authorities_query {
Link Here
|
304 |
}; |
304 |
}; |
305 |
} |
305 |
} |
306 |
} |
306 |
} |
307 |
elsif ( $op eq 'start') { |
307 |
elsif ( defined $op && $op eq 'start') { |
308 |
# Match the prefix within a field for all searchable fields. |
308 |
# Match the prefix within a field for all searchable fields. |
309 |
# Given that field data is "The quick brown fox" |
309 |
# Given that field data is "The quick brown fox" |
310 |
# "The quick bro" will match, but not "quick bro" |
310 |
# "The quick bro" will match, but not "quick bro" |
Lines 464-469
sub build_authorities_query_compat {
Link Here
|
464 |
# This turns the old-style many-options argument form into a more |
464 |
# This turns the old-style many-options argument form into a more |
465 |
# extensible hash form that is understood by L<build_authorities_query>. |
465 |
# extensible hash form that is understood by L<build_authorities_query>. |
466 |
my @searches; |
466 |
my @searches; |
|
|
467 |
my $mappings = $self->get_elasticsearch_mappings(); |
467 |
|
468 |
|
468 |
# Convert to lower case |
469 |
# Convert to lower case |
469 |
$marclist = [map(lc, @{$marclist})]; |
470 |
$marclist = [map(lc, @{$marclist})]; |
Lines 472-478
sub build_authorities_query_compat {
Link Here
|
472 |
my @indexes; |
473 |
my @indexes; |
473 |
# Make sure everything exists |
474 |
# Make sure everything exists |
474 |
foreach my $m (@$marclist) { |
475 |
foreach my $m (@$marclist) { |
475 |
push @indexes, exists $koha_to_index_name->{$m} ? $koha_to_index_name->{$m} : $m; |
476 |
|
|
|
477 |
$m = exists $koha_to_index_name->{$m} ? $koha_to_index_name->{$m} : $m; |
478 |
push @indexes, $m; |
479 |
warn "Unknown search field $m in marclist" unless (defined $mappings->{data}->{properties}->{$m} || $m eq ''); |
476 |
} |
480 |
} |
477 |
for ( my $i = 0 ; $i < @$value ; $i++ ) { |
481 |
for ( my $i = 0 ; $i < @$value ; $i++ ) { |
478 |
next unless $value->[$i]; #clean empty form values, ES doesn't like undefined searches |
482 |
next unless $value->[$i]; #clean empty form values, ES doesn't like undefined searches |