setGeoAnchor() public method

Set up anchor point for geosphere distance calculations. Required to use @geodist in filters and sorting
public setGeoAnchor ( string $attrlat, string $attrlong, float $lat, float $long ) : SphinxClient
$attrlat string latitude attribute name
$attrlong string longitude attribute name
$lat float anchor point latitude (in radians)
$long float anchor point longitude (in radians)
return SphinxClient
Example #1
0
 public function testGeoAnchor()
 {
     $sphinx = new SphinxClient();
     $sphinx->setGeoAnchor('lat', 'long', 0.4, 0.4)->setMatchMode(SphinxClient::SPH_MATCH_EXTENDED)->setSortMode(SphinxClient::SPH_SORT_EXTENDED, '@geodist desc')->setFilterFloatRange('@geodist', 0, 1934127);
     $results = $sphinx->query('a');
     $this->assertEquals(array_keys($results['matches']), array('1', '3', '4'));
 }
 /**
  * {@inheritdoc}
  */
 public function setGeoAnchor($attrlat, $attrlong, $lat, $long)
 {
     return $this->proxy->setGeoAnchor($attrlat, $attrlong, $lat, $long);
 }