diff --git a/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php b/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php index 9dbde25a..bbb69d22 100644 --- a/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php +++ b/classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php @@ -59,11 +59,12 @@ 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.':[-90,-90 TO 90,90]'; + $queryParams['fq'][] = $fieldName.':[-180,-90 TO 180,90]'; } catch( Exception $e ) { @@ -72,4 +73,4 @@ public function filterQueryParams( array $queryParams, array $filterParams ) return $queryParams; } -} \ No newline at end of file +}