summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Facet/Range.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Facet/Range.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Facet/Range.php41
1 files changed, 23 insertions, 18 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Facet/Range.php b/vendor/ruflin/elastica/lib/Elastica/Facet/Range.php
index 194f611a..f81caf3d 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Facet/Range.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Facet/Range.php
@@ -1,5 +1,4 @@
<?php
-
namespace Elastica\Facet;
use Elastica\Exception\InvalidException;
@@ -7,18 +6,19 @@ use Elastica\Exception\InvalidException;
/**
* Implements the range facet.
*
- * @category Xodoa
- * @package Elastica
* @author Jasper van Wanrooy <jasper@vanwanrooy.net>
- * @link http://www.elasticsearch.org/guide/reference/api/search/facets/range-facet.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/search-facets-range-facet.html
+ * @deprecated Facets are deprecated and will be removed in a future release. You are encouraged to migrate to aggregations instead.
*/
class Range extends AbstractFacet
{
/**
* Sets the field for the range.
*
- * @param string $field The name of the field for range.
- * @return \Elastica\Facet\Range
+ * @param string $field The name of the field for range.
+ *
+ * @return $this
*/
public function setField($field)
{
@@ -28,9 +28,10 @@ class Range extends AbstractFacet
/**
* Sets the fields by their separate key and value fields.
*
- * @param string $keyField The key_field param for the range.
- * @param string $valueField The key_value param for the range.
- * @return \Elastica\Facet\Range
+ * @param string $keyField The key_field param for the range.
+ * @param string $valueField The key_value param for the range.
+ *
+ * @return $this
*/
public function setKeyValueFields($keyField, $valueField)
{
@@ -44,7 +45,7 @@ class Range extends AbstractFacet
* @param string $keyScript Script to check whether it falls into the range.
* @param string $valueScript Script to use for statistical calculations.
*
- * @return \Elastica\Facet\Range
+ * @return $this
*/
public function setKeyValueScripts($keyScript, $valueScript)
{
@@ -59,10 +60,11 @@ class Range extends AbstractFacet
* array('from' => 20, 'to' 70),
* array('from' => 70, 'to' => 120),
* array('from' => 150)
- * )
+ * ).
*
- * @param array $ranges Numerical array with range definitions.
- * @return \Elastica\Facet\Range
+ * @param array $ranges Numerical array with range definitions.
+ *
+ * @return $this
*/
public function setRanges(array $ranges)
{
@@ -72,9 +74,10 @@ class Range extends AbstractFacet
/**
* Adds a range to the range facet.
*
- * @param mixed $from The from for the range.
- * @param mixed $to The to for the range.
- * @return \Elastica\Facet\Range
+ * @param mixed $from The from for the range.
+ * @param mixed $to The to for the range.
+ *
+ * @return $this
*/
public function addRange($from = null, $to = null)
{
@@ -99,12 +102,14 @@ class Range extends AbstractFacet
* facet definition of the parent.
*
* @see \Elastica\Facet\AbstractFacet::toArray()
+ *
* @throws \Elastica\Exception\InvalidException When the right fields haven't been set.
+ *
* @return array
*/
public function toArray()
{
- /**
+ /*
* Check the facet for validity.
* There are three ways to set the key and value field for the range:
* - a single field for both key and value; or
@@ -128,7 +133,7 @@ class Range extends AbstractFacet
throw new InvalidException('Either field, key_field and key_value or key_script and value_script should be set.');
}
- /**
+ /*
* Set the range in the abstract as param.
*/
$this->_setFacetParam('range', $this->_params);