Beispiel #1
0
 /**
  * @group functional
  */
 public function testGeoDistanceAggregation()
 {
     $agg = new GeoDistance('geo', 'location', array('lat' => 32.804654, 'lon' => -117.242594));
     $agg->addRange(null, 100);
     $agg->setUnit('mi');
     $query = new Query();
     $query->addAggregation($agg);
     $results = $this->_getIndexForTest()->search($query)->getAggregation('geo');
     $this->assertEquals(2, $results['buckets'][0]['doc_count']);
 }
 public function testGeoDistanceAggregation()
 {
     $agg = new GeoDistance("geo", "location", array("lat" => 32.804654, "lon" => -117.242594));
     $agg->addRange(null, 100);
     $agg->setUnit("mi");
     $query = new Query();
     $query->addAggregation($agg);
     $results = $this->_index->search($query)->getAggregation("geo");
     $this->assertEquals(2, $results['buckets'][0]['doc_count']);
 }