Mmanos\Search\Query::whereLocation PHP Method

whereLocation() public method

Add a geo distance where clause to the query.
public whereLocation ( float $lat, float $long, integer $distance_in_meters = 10000 ) : Query
$lat float
$long float
$distance_in_meters integer
return Query
    public function whereLocation($lat, $long, $distance_in_meters = 10000)
    {
        $this->query = $this->index->addConditionToQuery($this->query, array('lat' => $lat, 'long' => $long, 'distance' => $distance_in_meters));
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Initialize and return a new Query instance on this index
  * with the requested geo distance where clause.
  *
  * @param float $lat
  * @param float $long
  * @param int   $distance_in_meters
  * 
  * @return \Mmanos\Search\Query
  */
 public function whereLocation($lat, $long, $distance_in_meters = 10000)
 {
     $query = new Query($this);
     return $query->whereLocation($lat, $long, $distance_in_meters);
 }