diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-17 09:15:42 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-17 09:44:51 +0100 |
commit | a1789ddde42033f1b05cc4929491214ee6e79383 (patch) | |
tree | 63615735c4ddffaaabf2428946bb26f90899f7bf /vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php | |
parent | 9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff) |
Update to MediaWiki 1.26.0
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php new file mode 100644 index 00000000..f4cb51d9 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php @@ -0,0 +1,76 @@ +<?php +namespace Elastica\Filter; + +/** + * Geo distance filter. + * + * @author Nicolas Ruflin <spam@ruflin.com> + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-filter.html + */ +class GeoDistance extends AbstractGeoDistance +{ + const DISTANCE_TYPE_ARC = 'arc'; + const DISTANCE_TYPE_PLANE = 'plane'; + const DISTANCE_TYPE_SLOPPY_ARC = 'sloppy_arc'; + + const OPTIMIZE_BBOX_MEMORY = 'memory'; + const OPTIMIZE_BBOX_INDEXED = 'indexed'; + const OPTIMIZE_BBOX_NONE = 'none'; + + /** + * Create GeoDistance object. + * + * @param string $key Key + * @param array|string $location Location as array or geohash: array('lat' => 48.86, 'lon' => 2.35) OR 'drm3btev3e86' + * @param string $distance Distance + * + * @throws \Elastica\Exception\InvalidException + */ + public function __construct($key, $location, $distance) + { + parent::__construct($key, $location); + + $this->setDistance($distance); + } + + /** + * @param string $distance + * + * @return $this + */ + public function setDistance($distance) + { + $this->setParam('distance', $distance); + + return $this; + } + + /** + * See DISTANCE_TYPE_* constants. + * + * @param string $distanceType + * + * @return $this + */ + public function setDistanceType($distanceType) + { + $this->setParam('distance_type', $distanceType); + + return $this; + } + + /** + * See OPTIMIZE_BBOX_* constants. + * + * @param string $optimizeBbox + * + * @return $this + */ + public function setOptimizeBbox($optimizeBbox) + { + $this->setParam('optimize_bbox', $optimizeBbox); + + return $this; + } +} |