Bug 31652: Perltidy
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
4bed77da08
commit
27c496a50d
2 changed files with 12 additions and 15 deletions
|
@ -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};
|
next unless $record_document->{$field};
|
||||||
my $geofield = $field;
|
my $geofield = $field;
|
||||||
$geofield =~ s/_(lat|lon)$//;
|
$geofield =~ s/_(lat|lon)$//;
|
||||||
my $axis = $1;
|
my $axis = $1;
|
||||||
my $vals = $record_document->{$field};
|
my $vals = $record_document->{$field};
|
||||||
for my $i (0 .. @$vals - 1) {
|
for my $i ( 0 .. @$vals - 1 ) {
|
||||||
my $val = $record_document->{$field}[$i];
|
my $val = $record_document->{$field}[$i];
|
||||||
$record_document->{$geofield}[$i]{$axis} = $val;
|
$record_document->{$geofield}[$i]{$axis} = $val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -936,10 +936,10 @@ sub _create_query_string {
|
||||||
$es_advanced_searches = [];
|
$es_advanced_searches = [];
|
||||||
my @string_queries;
|
my @string_queries;
|
||||||
foreach my $q (@queries) {
|
foreach my $q (@queries) {
|
||||||
if ($q->{field} && $q->{field} eq 'geolocation') {
|
if ( $q->{field} && $q->{field} eq 'geolocation' ) {
|
||||||
push(@$es_advanced_searches, $q);
|
push( @$es_advanced_searches, $q );
|
||||||
} else {
|
} else {
|
||||||
push(@string_queries, $q)
|
push( @string_queries, $q );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1428,27 +1428,24 @@ sub _rebuild_to_es_advanced_query {
|
||||||
|
|
||||||
my %filter;
|
my %filter;
|
||||||
for my $advanced_query (@$es_advanced_searches) {
|
for my $advanced_query (@$es_advanced_searches) {
|
||||||
if ( $advanced_query->{field} eq 'geolocation') {
|
if ( $advanced_query->{field} eq 'geolocation' ) {
|
||||||
my ($lat, $lon, $distance) = map { $_ =~ /:(.*)\*/ } split('\s+', $advanced_query->{operand});
|
my ( $lat, $lon, $distance ) = map { $_ =~ /:(.*)\*/ } split( '\s+', $advanced_query->{operand} );
|
||||||
$filter{geo_distance} = {
|
$filter{geo_distance} = {
|
||||||
distance => $distance,
|
distance => $distance,
|
||||||
geolocation => {
|
geolocation => {
|
||||||
lat => $lat,
|
lat => $lat,
|
||||||
lon => $lon,
|
lon => $lon,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
} else {
|
||||||
else {
|
warn "unknown advanced ElasticSearch query: " . join( ', ', %$advanced_query );
|
||||||
warn "unknown advanced ElasticSearch query: ".join(', ',%$advanced_query);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$res->{query} = {
|
$res->{query} = {
|
||||||
bool => {
|
bool => {
|
||||||
must => {
|
must => { query_string => $query_string },
|
||||||
query_string => $query_string
|
filter => \%filter,
|
||||||
},
|
|
||||||
filter => \%filter,
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue