diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-08-16 08:22:05 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-08-16 08:22:05 +0200 |
commit | 1a365e77dfb8825136626202b1df462731b42060 (patch) | |
tree | 1dc4468eaabf070e051e790a9e67a9a9a2c63d99 /vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php | |
parent | a72fd280f7acb4d2a1ba579a0f1b2b2ae8958530 (diff) |
Update to MediaWiki 1.25.2
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php new file mode 100644 index 00000000..d14b25fe --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php @@ -0,0 +1,45 @@ +<?php + +namespace Elastica\Filter; + + +/** + * Class GeohashCell + * @package Elastica + * @link http://www.elasticsearch.org/guide/reference/query-dsl/geohash-cell-filter/ + */ +class GeohashCell extends AbstractGeoDistance +{ + /** + * @param string $key The field on which to filter + * @param array|string $location Location as coordinates array or geohash string ['lat' => 40.3, 'lon' => 45.2] + * @param $precision Integer length of geohash prefix or distance (3, or "50m") + * @param bool $neighbors If true, filters cells next to the given cell. + */ + public function __construct($key, $location, $precision = -1, $neighbors = false) + { + parent::__construct($key, $location); + $this->setPrecision($precision); + $this->setNeighbors($neighbors); + } + + /** + * Set the precision for this filter + * @param string|int $precision Integer length of geohash prefix or distance (3, or "50m") + * @return \Elastica\Filter\GeohashCell + */ + public function setPrecision($precision) + { + return $this->setParam('precision', $precision); + } + + /** + * Set the neighbors option for this filter + * @param bool $neighbors If true, filters cells next to the given cell. + * @return \Elastica\Filter\GeohashCell + */ + public function setNeighbors($neighbors) + { + return $this->setParam('neighbors', (bool)$neighbors); + } +}
\ No newline at end of file |