Skip to content

Commit e62898f

Browse files
deguifruflin
authored andcommitted
GeoPolygon - Fix wrong property passed to \count() (#1696)
1 parent d3dc5a7 commit e62898f

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ All notable changes to this project will be documented in this file based on the
5050

5151
### Bugfixes
5252

53+
* The `\Elastica\Query\GeoPolygon::count()` method now returns the count of points passed to the filter [#1696](https://github.com/ruflin/Elastica/pull/1696)
5354
* Always set the Guzzle `base_uri` to support connecting to multiple ES hosts. [#1618](https://github.com/ruflin/Elastica/pull/1618)
5455
* 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)
5556
* Preserve zeros while doing float serialization to JSON. [#1635](https://github.com/ruflin/Elastica/pull/1635)

lib/Elastica/Query/GeoPolygon.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ public function toArray(): array
5656
*/
5757
public function count(): int
5858
{
59-
return \count($this->_key);
59+
return \count($this->_points);
6060
}
6161
}

test/Elastica/Query/GeoPolygonTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function testGeoPoint()
4646
// Only one point should be in polygon
4747
$points = [[16, 16], [16, 20], [20, 20], [20, 16], [16, 16]];
4848
$geoQuery = new GeoPolygon('location', $points);
49+
$this->assertCount(\count($points), $geoQuery);
4950

5051
$query = new Query(new MatchAll());
5152
$query->setPostFilter($geoQuery);

0 commit comments

Comments
 (0)