From 27c496a50dac1698fdba2dafa3b5178b4cf8dc25 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Mon, 29 Apr 2024 12:46:39 +0000 Subject: [PATCH] Bug 31652: Perltidy Signed-off-by: Katrin Fischer --- Koha/SearchEngine/Elasticsearch.pm | 4 ++-- .../Elasticsearch/QueryBuilder.pm | 23 ++++++++----------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 54f3ea8f72..c3c2d27e01 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -741,13 +741,13 @@ sub marc_records_to_documents { } } - foreach my $field (@{$rules->{geo_point}}) { + foreach my $field ( @{ $rules->{geo_point} } ) { next unless $record_document->{$field}; my $geofield = $field; $geofield =~ s/_(lat|lon)$//; my $axis = $1; my $vals = $record_document->{$field}; - for my $i (0 .. @$vals - 1) { + for my $i ( 0 .. @$vals - 1 ) { my $val = $record_document->{$field}[$i]; $record_document->{$geofield}[$i]{$axis} = $val; } diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 53541c4022..e8f28a9200 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -936,10 +936,10 @@ sub _create_query_string { $es_advanced_searches = []; my @string_queries; foreach my $q (@queries) { - if ($q->{field} && $q->{field} eq 'geolocation') { - push(@$es_advanced_searches, $q); + if ( $q->{field} && $q->{field} eq 'geolocation' ) { + push( @$es_advanced_searches, $q ); } else { - push(@string_queries, $q) + push( @string_queries, $q ); } } @@ -1428,27 +1428,24 @@ sub _rebuild_to_es_advanced_query { my %filter; for my $advanced_query (@$es_advanced_searches) { - if ( $advanced_query->{field} eq 'geolocation') { - my ($lat, $lon, $distance) = map { $_ =~ /:(.*)\*/ } split('\s+', $advanced_query->{operand}); + if ( $advanced_query->{field} eq 'geolocation' ) { + my ( $lat, $lon, $distance ) = map { $_ =~ /:(.*)\*/ } split( '\s+', $advanced_query->{operand} ); $filter{geo_distance} = { - distance => $distance, + distance => $distance, geolocation => { lat => $lat, lon => $lon, } }; - } - else { - warn "unknown advanced ElasticSearch query: ".join(', ',%$advanced_query); + } else { + warn "unknown advanced ElasticSearch query: " . join( ', ', %$advanced_query ); } } $res->{query} = { bool => { - must => { - query_string => $query_string - }, - filter => \%filter, + must => { query_string => $query_string }, + filter => \%filter, } };