summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Filter/Range.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter/Range.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Range.php44
1 files changed, 28 insertions, 16 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Range.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Range.php
index b142e674..1e7bf132 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Range.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Range.php
@@ -1,31 +1,29 @@
<?php
-
namespace Elastica\Filter;
/**
- * Range Filter
+ * Range Filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/range-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-filter.html
*/
class Range extends AbstractFilter
{
/**
- * Fields
+ * Fields.
*
* @var array Fields
*/
protected $_fields = array();
/**
- * Construct range filter
+ * Construct range filter.
*
- * @param string|bool $fieldName Field name
- * @param array $args Field arguments
+ * @param string $fieldName Field name
+ * @param array $args Field arguments
*/
- public function __construct($fieldName = false, array $args = array())
+ public function __construct($fieldName = '', array $args = array())
{
if ($fieldName) {
$this->addField($fieldName, $args);
@@ -33,11 +31,12 @@ class Range extends AbstractFilter
}
/**
- * Ads a field with arguments to the range query
+ * Ads a field with arguments to the range query.
+ *
+ * @param string $fieldName Field name
+ * @param array $args Field arguments
*
- * @param string $fieldName Field name
- * @param array $args Field arguments
- * @return \Elastica\Filter\Range
+ * @return $this
*/
public function addField($fieldName, array $args)
{
@@ -47,14 +46,27 @@ class Range extends AbstractFilter
}
/**
- * Converts object to array
+ * 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($this->_fields);
+ $this->setParams(array_merge($this->getParams(), $this->_fields));
return parent::toArray();
}