From 4103561824c03532795e9e62fde8b9ff805189d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morel=20S=C3=A9bastien?= Date: Wed, 8 Apr 2015 01:11:32 -0700 Subject: [PATCH 1/2] Fix the range of latitude/longitude --- .../ezfindgeodistextendedattributefilter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php b/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php index 9dbde25a..09b9e131 100644 --- a/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php +++ b/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php @@ -63,7 +63,7 @@ public function filterQueryParams( array $queryParams, array $filterParams ) $queryParams['sort'] = 'geodist() asc,' . $queryParams['sort']; //exclude unlocated documents - $queryParams['fq'][] = $fieldName.':[-90,-90 TO 90,90]'; + $queryParams['fq'][] = $fieldName.':[-180,-90 TO 180,90]'; } catch( Exception $e ) { @@ -72,4 +72,4 @@ public function filterQueryParams( array $queryParams, array $filterParams ) return $queryParams; } -} \ No newline at end of file +} From e9b1ed8a06a1e79a322d19cfcfb8a938073181ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morel=20S=C3=A9bastien?= Date: Thu, 9 Apr 2015 00:11:19 -0700 Subject: [PATCH 2/2] Fix the sorting result --- .../ezfindgeodistextendedattributefilter.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php b/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php index 09b9e131..bbb69d22 100644 --- a/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php +++ b/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php @@ -59,8 +59,9 @@ public function filterQueryParams( array $queryParams, array $filterParams ) $queryParams['sfield'] = $fieldName; $queryParams['pt'] = $filterParams['latitude'] . ',' . $filterParams['longitude']; - //sort by geodist - $queryParams['sort'] = 'geodist() asc,' . $queryParams['sort']; + //sort by geodist, according to ezfsolrdocumentfieldgmaplocation line 46, eZ indexes longitude,latitude + $geodistOrigin = $filterParams['longitude'] . "," . $filterParams['latitude']; + $queryParams['sort'] = "geodist($fieldName,$geodistOrigin) asc," . $queryParams['sort']; //exclude unlocated documents $queryParams['fq'][] = $fieldName.':[-180,-90 TO 180,90]';