Skip to content

Commit

Permalink
class renamed + use of new trait
Browse files Browse the repository at this point in the history
  • Loading branch information
krewetka committed Dec 4, 2020
1 parent faa1486 commit 62a42c0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added `Elastica\Aggregation\GeoDistance::setKeyed()` [#1876](https://github.com/ruflin/Elastica/pull/1876)
* Added `Elastica\Aggregation\Histogram::setKeyed()` [#1876](https://github.com/ruflin/Elastica/pull/1876)
* Added `Elastica\Aggregation\IpRange::setKeyed()` [#1876](https://github.com/ruflin/Elastica/pull/1876)
* Added `Elastica\Aggregation\GeotileGrid` [#1880](https://github.com/ruflin/Elastica/pull/1880)
* Added `Elastica\Aggregation\GeotileGridAggregation` [#1880](https://github.com/ruflin/Elastica/pull/1880)
### Changed
* Allow `string` such as `wait_for` to be passed to `AbstractUpdateAction::setRefresh` [#1791](https://github.com/ruflin/Elastica/pull/1791)
* Changed the return type of `AbstractUpdateAction::getRefresh` to `boolean|string` [#1791](https://github.com/ruflin/Elastica/pull/1791)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
namespace Elastica\Aggregation;

/**
* Class GeotileGrid.
* Class GeotileGridAggregation.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geotilegrid-aggregation.html
*/
class GeotileGrid extends AbstractAggregation
class GeotileGridAggregation extends AbstractAggregation
{
public const DEFAULT_PRECISION_VALUE = 5;
public const DEFAULT_SIZE_VALUE = 10000;
use Traits\ShardSizeTrait;

/**
* @param string $name the name of this aggregation
Expand Down Expand Up @@ -57,14 +56,4 @@ public function setSize(int $size): self
{
return $this->setParam('size', $size);
}

/**
* Set the number of results returned from each shard.
*
* @return $this
*/
public function setShardSize(int $shardSize): self
{
return $this->setParam('shard_size', $shardSize);
}
}
6 changes: 3 additions & 3 deletions src/QueryBuilder/DSL/Aggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Elastica\Aggregation\Filters;
use Elastica\Aggregation\GeoDistance;
use Elastica\Aggregation\GeohashGrid;
use Elastica\Aggregation\GeotileGrid;
use Elastica\Aggregation\GeotileGridAggregation;
use Elastica\Aggregation\GlobalAggregation;
use Elastica\Aggregation\Histogram;
use Elastica\Aggregation\IpRange;
Expand Down Expand Up @@ -413,9 +413,9 @@ public function geohash_grid(string $name, string $field): GeohashGrid
* @param string $name the name of this aggregation
* @param string $field the field on which to perform this aggregation
*/
public function geotile_grid(string $name, string $field): GeotileGrid
public function geotile_grid(string $name, string $field): GeotileGridAggregation
{
return new GeotileGrid($name, $field);
return new GeotileGridAggregation($name, $field);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Test\Aggregation;

use Elastica\Aggregation\GeotileGrid;
use Elastica\Aggregation\GeotileGridAggregation;
use Elastica\Document;
use Elastica\Index;
use Elastica\Mapping;
Expand All @@ -11,14 +11,14 @@
/**
* @internal
*/
class GeotileGridTest extends BaseAggregationTest
class GeotileGridAggregationTest extends BaseAggregationTest
{
/**
* @group functional
*/
public function testGeotileGridAggregation(): void
{
$agg = new GeotileGrid('tile', 'location');
$agg = new GeotileGridAggregation('tile', 'location');
$agg->setPrecision(7);

$query = new Query();
Expand Down
2 changes: 1 addition & 1 deletion tests/QueryBuilder/DSL/AggregationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testInterface(): void
$this->_assertImplemented($aggregationDSL, 'filters', Aggregation\Filters::class, ['name']);
$this->_assertImplemented($aggregationDSL, 'geo_distance', Aggregation\GeoDistance::class, ['name', 'field', 'origin']);
$this->_assertImplemented($aggregationDSL, 'geohash_grid', Aggregation\GeohashGrid::class, ['name', 'field']);
$this->_assertImplemented($aggregationDSL, 'geotile_grid', Aggregation\GeotileGrid::class, ['name', 'field']);
$this->_assertImplemented($aggregationDSL, 'geotile_grid', Aggregation\GeotileGridAggregation::class, ['name', 'field']);
$this->_assertImplemented($aggregationDSL, 'global', Aggregation\GlobalAggregation::class, ['name']);
$this->_assertImplemented($aggregationDSL, 'histogram', Aggregation\Histogram::class, ['name', 'field', 1]);
$this->_assertImplemented($aggregationDSL, 'ipv4_range', Aggregation\IpRange::class, ['name', 'field']);
Expand Down

0 comments on commit 62a42c0

Please sign in to comment.