Skip to content

Commit

Permalink
GeoPolygon - Fix wrong property passed to \count() (#1696)
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif authored and ruflin committed Nov 18, 2019
1 parent d3dc5a7 commit e62898f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ All notable changes to this project will be documented in this file based on the

### Bugfixes

* The `\Elastica\Query\GeoPolygon::count()` method now returns the count of points passed to the filter [#1696](https://github.com/ruflin/Elastica/pull/1696)
* Always set the Guzzle `base_uri` to support connecting to multiple ES hosts. [#1618](https://github.com/ruflin/Elastica/pull/1618)
* Properly handle underscore prefixes in options and bulk request metadata ([cf upstream](https://github.com/elastic/elasticsearch/issues/26886). [#1621](https://github.com/ruflin/Elastica/pull/1621)
* Preserve zeros while doing float serialization to JSON. [#1635](https://github.com/ruflin/Elastica/pull/1635)
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Query/GeoPolygon.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ public function toArray(): array
*/
public function count(): int
{
return \count($this->_key);
return \count($this->_points);
}
}
1 change: 1 addition & 0 deletions test/Elastica/Query/GeoPolygonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function testGeoPoint()
// Only one point should be in polygon
$points = [[16, 16], [16, 20], [20, 20], [20, 16], [16, 16]];
$geoQuery = new GeoPolygon('location', $points);
$this->assertCount(\count($points), $geoQuery);

$query = new Query(new MatchAll());
$query->setPostFilter($geoQuery);
Expand Down

0 comments on commit e62898f

Please sign in to comment.