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/Range.php | |
parent | 9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff) |
Update to MediaWiki 1.26.0
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter/Range.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Filter/Range.php | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Range.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Range.php new file mode 100644 index 00000000..1e7bf132 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Range.php @@ -0,0 +1,73 @@ +<?php +namespace Elastica\Filter; + +/** + * Range Filter. + * + * @author Nicolas Ruflin <spam@ruflin.com> + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-filter.html + */ +class Range extends AbstractFilter +{ + /** + * Fields. + * + * @var array Fields + */ + protected $_fields = array(); + + /** + * Construct range filter. + * + * @param string $fieldName Field name + * @param array $args Field arguments + */ + public function __construct($fieldName = '', array $args = array()) + { + if ($fieldName) { + $this->addField($fieldName, $args); + } + } + + /** + * Ads a field with arguments to the range query. + * + * @param string $fieldName Field name + * @param array $args Field arguments + * + * @return $this + */ + public function addField($fieldName, array $args) + { + $this->_fields[$fieldName] = $args; + + return $this; + } + + /** + * Set execution mode. + * + * @param string $execution Options: "index" or "fielddata" + * + * @return $this + */ + public function setExecution($execution) + { + return $this->setParam('execution', (string) $execution); + } + + /** + * Converts object to array. + * + * @see \Elastica\Filter\AbstractFilter::toArray() + * + * @return array Filter array + */ + public function toArray() + { + $this->setParams(array_merge($this->getParams(), $this->_fields)); + + return parent::toArray(); + } +} |