For this to work, attrlat and attrlng need to be in lower case otherwise you will get :
"unknown latitude attribute ''"
SphinxClient::setGeoAnchor
(PECL sphinx >= 0.1.0)
SphinxClient::setGeoAnchor — Configure le point d'origine pour les calculs géographiques
Description
public bool SphinxClient::setGeoAnchor
( string
$attrlat
, string $attrlong
, float $latitude
, float $longitude
)Configure le point d'origine pour les calculs géographiques.
Une fois que l'origine est configurée, vous pouvez utiliser l'attribut magique "@geodist" dans vos filtres et vos expressions de tri.
Liste de paramètres
-
attrlat -
Nom de l'attribut de latitude.
-
attrlong -
Nom de l'attribut de longitude.
-
latitude -
Latitude d'origine en radians.
-
longitude -
Longitude d'origine en radians.
Valeurs de retour
Cette fonction retourne TRUE en cas de
succès ou FALSE si une erreur survient.
michel dot bartz at igotchamedia dot com
20-Jul-2011 07:17
k dot andris at gmail dot com
07-Oct-2010 12:55
When sorting on @geodist you have to use SetSortMode with SPH_SORT_EXTENDED, like below, if SPH_SORT_ATTR_ASC does not seem to work.
$sphinx->SetSortMode(SPH_SORT_EXTENDED, '@geodist ASC');
