summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Filter
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/AbstractFilter.php32
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoDistance.php58
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoShape.php22
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/AbstractMulti.php34
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Bool.php143
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/BoolAnd.php8
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/BoolFilter.php133
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/BoolNot.php17
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/BoolOr.php8
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Exists.php17
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/GeoBoundingBox.php24
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php37
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistanceRange.php24
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/GeoPolygon.php23
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapePreIndexed.php29
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapeProvided.php35
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php32
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/HasChild.php63
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php50
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Ids.php40
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php57
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Limit.php20
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/MatchAll.php10
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Missing.php41
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Nested.php40
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/NumericRange.php8
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Prefix.php23
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Query.php25
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Range.php44
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Regexp.php62
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Script.php20
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Term.php26
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Terms.php75
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Type.php33
34 files changed, 726 insertions, 587 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractFilter.php b/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractFilter.php
index 665f155f..7c7dc4f7 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractFilter.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractFilter.php
@@ -1,25 +1,24 @@
<?php
-
namespace Elastica\Filter;
use Elastica\Exception\InvalidException;
use Elastica\Param;
/**
- * Abstract filter object. Should be extended by all filter types
+ * Abstract filter object. Should be extended by all filter types.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-filters.html
*/
abstract class AbstractFilter extends Param
{
/**
- * Sets the filter cache
+ * Sets the filter cache.
+ *
+ * @param bool $cached Cached
*
- * @param boolean $cached Cached
- * @return \Elastica\Filter\AbstractFilter
+ * @return $this
*/
public function setCached($cached = true)
{
@@ -27,11 +26,13 @@ abstract class AbstractFilter extends Param
}
/**
- * Sets the filter cache key
+ * Sets the filter cache key.
*
- * @param string $cacheKey Cache key
- * @throws \Elastica\Exception\InvalidException
- * @return \Elastica\Filter\AbstractFilter
+ * @param string $cacheKey Cache key
+ *
+ * @throws \Elastica\Exception\InvalidException If given key is empty
+ *
+ * @return $this
*/
public function setCacheKey($cacheKey)
{
@@ -45,10 +46,11 @@ abstract class AbstractFilter extends Param
}
/**
- * Sets the filter name
+ * Sets the filter name.
+ *
+ * @param string $name Name
*
- * @param string $name Name
- * @return \Elastica\Filter\AbstractFilter
+ * @return $this
*/
public function setName($name)
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoDistance.php b/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoDistance.php
index 997ceab7..b208afb4 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoDistance.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoDistance.php
@@ -1,25 +1,22 @@
<?php
-
namespace Elastica\Filter;
use Elastica\Exception\InvalidException;
/**
- * Geo distance filter
+ * Geo distance filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-filter.html
*/
abstract class AbstractGeoDistance extends AbstractFilter
{
-
const LOCATION_TYPE_GEOHASH = 'geohash';
const LOCATION_TYPE_LATLON = 'latlon';
/**
- * Location type
+ * Location type.
*
* Decides if this filter uses latitude/longitude or geohash for the location.
* Values are "latlon" or "geohash".
@@ -29,38 +26,39 @@ abstract class AbstractGeoDistance extends AbstractFilter
protected $_locationType = null;
/**
- * Key
+ * Key.
*
* @var string
*/
protected $_key = null;
/**
- * Latitude
+ * Latitude.
*
* @var float
*/
protected $_latitude = null;
/**
- * Longitude
+ * Longitude.
*
* @var float
*/
protected $_longitude = null;
/**
- * Geohash
+ * Geohash.
*
* @var string
*/
protected $_geohash = null;
/**
- * Create GeoDistance object
+ * 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 $key Key
- * @param array|string $location Location as array or geohash: array('lat' => 48.86, 'lon' => 2.35) OR 'drm3btev3e86'
* @internal param string $distance Distance
*/
public function __construct($key, $location)
@@ -71,8 +69,9 @@ abstract class AbstractGeoDistance extends AbstractFilter
}
/**
- * @param string $key
- * @return \Elastica\Filter\AbstractGeoDistance current filter
+ * @param string $key
+ *
+ * @return $this
*/
public function setKey($key)
{
@@ -82,9 +81,11 @@ abstract class AbstractGeoDistance extends AbstractFilter
}
/**
- * @param array|string $location
- * @return \Elastica\Filter\AbstractGeoDistance
+ * @param array|string $location
+ *
* @throws \Elastica\Exception\InvalidException
+ *
+ * @return $this
*/
public function setLocation($location)
{
@@ -113,8 +114,9 @@ abstract class AbstractGeoDistance extends AbstractFilter
}
/**
- * @param float $latitude
- * @return \Elastica\Filter\AbstractGeoDistance current filter
+ * @param float $latitude
+ *
+ * @return $this
*/
public function setLatitude($latitude)
{
@@ -125,8 +127,9 @@ abstract class AbstractGeoDistance extends AbstractFilter
}
/**
- * @param float $longitude
- * @return \Elastica\Filter\AbstractGeoDistance current filter
+ * @param float $longitude
+ *
+ * @return $this
*/
public function setLongitude($longitude)
{
@@ -137,8 +140,9 @@ abstract class AbstractGeoDistance extends AbstractFilter
}
/**
- * @param string $geohash
- * @return \Elastica\Filter\AbstractGeoDistance current filter
+ * @param string $geohash
+ *
+ * @return $this
*/
public function setGeohash($geohash)
{
@@ -149,8 +153,9 @@ abstract class AbstractGeoDistance extends AbstractFilter
}
/**
- * @return array|string
* @throws \Elastica\Exception\InvalidException
+ *
+ * @return array|string
*/
protected function _getLocationData()
{
@@ -179,7 +184,10 @@ abstract class AbstractGeoDistance extends AbstractFilter
/**
* @see \Elastica\Param::toArray()
+ *
* @throws \Elastica\Exception\InvalidException
+ *
+ * @return array
*/
public function toArray()
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoShape.php b/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoShape.php
index 3585293b..4f5c0f93 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoShape.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractGeoShape.php
@@ -1,32 +1,30 @@
<?php
-
namespace Elastica\Filter;
/**
- * geo_shape filter
+ * geo_shape filter.
*
* Filter pre-indexed shape definitions
*
- * @category Xodoa
- * @package Elastica
* @author Bennie Krijger <benniekrijger@gmail.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geo-shape-filter/
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-filter.html
*/
abstract class AbstractGeoShape extends AbstractFilter
{
- const RELATION_INTERSECT = 'intersects';
- const RELATION_DISJOINT = 'disjoint';
- const RELATION_CONTAINS = 'within';
+ const RELATION_INTERSECT = 'intersects';
+ const RELATION_DISJOINT = 'disjoint';
+ const RELATION_CONTAINS = 'within';
/**
- * @var string $_path
+ * @var string
*
* elasticsearch path of the pre-indexed shape
*/
protected $_path;
/**
- * @var string $_relation
+ * @var string
*
* the relation of the 2 shaped: intersects, disjoint, within
*/
@@ -34,10 +32,14 @@ abstract class AbstractGeoShape extends AbstractFilter
/**
* @param string $relation
+ *
+ * @return $this
*/
public function setRelation($relation)
{
$this->_relation = $relation;
+
+ return $this;
}
/**
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractMulti.php b/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractMulti.php
index 53ef74cf..06f6daea 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractMulti.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/AbstractMulti.php
@@ -1,27 +1,36 @@
<?php
-
namespace Elastica\Filter;
/**
- * Multi Abstract filter object. Should be extended by filter types composed of an array of sub filters
+ * Multi Abstract filter object. Should be extended by filter types composed of an array of sub filters.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
*/
abstract class AbstractMulti extends AbstractFilter
{
/**
- * Filters
+ * Filters.
+ *
* @var array
*/
protected $_filters = array();
/**
- * Add filter
+ * @param \Elastica\Filter\AbstractFilter $filters
+ */
+ public function __construct(array $filters = array())
+ {
+ if (!empty($filters)) {
+ $this->setFilters($filters);
+ }
+ }
+
+ /**
+ * Add filter.
+ *
+ * @param \Elastica\Filter\AbstractFilter $filter
*
- * @param \Elastica\Filter\AbstractFilter $filter
- * @return \Elastica\Filter\AbstractMulti
+ * @return $this
*/
public function addFilter(AbstractFilter $filter)
{
@@ -31,10 +40,11 @@ abstract class AbstractMulti extends AbstractFilter
}
/**
- * Set filters
+ * Set filters.
*
- * @param array $filters
- * @return \Elastica\Filter\AbstractMulti
+ * @param array $filters
+ *
+ * @return $this
*/
public function setFilters(array $filters)
{
@@ -57,6 +67,8 @@ abstract class AbstractMulti extends AbstractFilter
/**
* @see \Elastica\Param::toArray()
+ *
+ * @return array
*/
public function toArray()
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Bool.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Bool.php
index aff708f8..0d30f83f 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Bool.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Bool.php
@@ -1,146 +1,15 @@
<?php
-
namespace Elastica\Filter;
-use Elastica\Exception\InvalidException;
-
/**
- * Bool Filter
+ * Bool Filter.
+ *
+ * This class is for backward compatibility reason for all php < 7 versions. For PHP 7 and above use BoolFilter as Bool is reserved.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-filter.html
*/
-class Bool extends AbstractFilter
+class Bool extends BoolFilter
{
- /**
- * @var float
- */
- protected $_boost = 1.0;
-
- /**
- * Must
- *
- * @var array
- */
- protected $_must = array();
-
- /**
- * Should
- *
- * @var array
- */
- protected $_should = array();
-
- /**
- * Must not
- *
- * @var array
- */
- protected $_mustNot = array();
-
- /**
- * Adds should filter
- *
- * @param array|\Elastica\Filter\AbstractFilter $args Filter data
- * @return \Elastica\Filter\Bool Current object
- */
- public function addShould($args)
- {
- return $this->_addFilter('should', $args);
- }
-
- /**
- * Adds must filter
- *
- * @param array|\Elastica\Filter\AbstractFilter $args Filter data
- * @return \Elastica\Filter\Bool Current object
- */
- public function addMust($args)
- {
- return $this->_addFilter('must', $args);
- }
-
- /**
- * Adds mustNot filter
- *
- * @param array|\Elastica\Filter\AbstractFilter $args Filter data
- * @return \Elastica\Filter\Bool Current object
- */
- public function addMustNot($args)
- {
- return $this->_addFilter('mustNot', $args);
- }
-
- /**
- * Adds general filter based on type
- *
- * @param string $type Filter type
- * @param array|\Elastica\Filter\AbstractFilter $args Filter data
- * @throws \Elastica\Exception\InvalidException
- * @return \Elastica\Filter\Bool Current object
- */
- protected function _addFilter($type, $args)
- {
- if ($args instanceof AbstractFilter) {
- $args = $args->toArray();
- }
- else if (!is_array($args)) {
- throw new InvalidException('Invalid parameter. Has to be array or instance of Elastica\Filter');
- }
- else{
- $parsedArgs = array();
- foreach($args as $filter){
- if($filter instanceof AbstractFilter){
- $parsedArgs[] = $filter->toArray();
- }
- }
- $args = $parsedArgs;
- }
-
- $varName = '_' . $type;
- $this->{$varName}[] = $args;
-
- return $this;
- }
-
- /**
- * Converts bool filter to array
- *
- * @see \Elastica\Filter\AbstractFilter::toArray()
- * @return array Filter array
- */
- public function toArray()
- {
- $args = array();
-
- if (!empty($this->_must)) {
- $args['bool']['must'] = $this->_must;
- }
-
- if (!empty($this->_should)) {
- $args['bool']['should'] = $this->_should;
- }
-
- if (!empty($this->_mustNot)) {
- $args['bool']['must_not'] = $this->_mustNot;
- }
-
- return $args;
- }
-
- /**
- * Sets the boost value for this filter
- *
- * @param float $boost Boost
- * @return \Elastica\Filter\Bool Current object
- */
- public function setBoost($boost)
- {
- $this->_boost = $boost;
-
- return $this;
- }
-
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/BoolAnd.php b/vendor/ruflin/elastica/lib/Elastica/Filter/BoolAnd.php
index 2fd19f8e..8a08ea9c 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/BoolAnd.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/BoolAnd.php
@@ -1,14 +1,12 @@
<?php
-
namespace Elastica\Filter;
/**
- * And Filter
+ * And Filter.
*
- * @category Xodoa
- * @package Elastica
* @author Lee Parker, Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/and-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-and-filter.html
*/
class BoolAnd extends AbstractMulti
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/BoolFilter.php b/vendor/ruflin/elastica/lib/Elastica/Filter/BoolFilter.php
new file mode 100644
index 00000000..5a488b77
--- /dev/null
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/BoolFilter.php
@@ -0,0 +1,133 @@
+<?php
+namespace Elastica\Filter;
+
+use Elastica\Exception\InvalidException;
+
+/**
+ * Bool Filter.
+ *
+ * @author Nicolas Ruflin <spam@ruflin.com>
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-filter.html
+ */
+class BoolFilter extends AbstractFilter
+{
+ /**
+ * Must.
+ *
+ * @var array
+ */
+ protected $_must = array();
+
+ /**
+ * Should.
+ *
+ * @var array
+ */
+ protected $_should = array();
+
+ /**
+ * Must not.
+ *
+ * @var array
+ */
+ protected $_mustNot = array();
+
+ /**
+ * Adds should filter.
+ *
+ * @param array|\Elastica\Filter\AbstractFilter $args Filter data
+ *
+ * @return $this
+ */
+ public function addShould($args)
+ {
+ return $this->_addFilter('should', $args);
+ }
+
+ /**
+ * Adds must filter.
+ *
+ * @param array|\Elastica\Filter\AbstractFilter $args Filter data
+ *
+ * @return $this
+ */
+ public function addMust($args)
+ {
+ return $this->_addFilter('must', $args);
+ }
+
+ /**
+ * Adds mustNot filter.
+ *
+ * @param array|\Elastica\Filter\AbstractFilter $args Filter data
+ *
+ * @return $this
+ */
+ public function addMustNot($args)
+ {
+ return $this->_addFilter('mustNot', $args);
+ }
+
+ /**
+ * Adds general filter based on type.
+ *
+ * @param string $type Filter type
+ * @param array|\Elastica\Filter\AbstractFilter $args Filter data
+ *
+ * @throws \Elastica\Exception\InvalidException
+ *
+ * @return $this
+ */
+ protected function _addFilter($type, $args)
+ {
+ if ($args instanceof AbstractFilter) {
+ $args = $args->toArray();
+ } elseif (!is_array($args)) {
+ throw new InvalidException('Invalid parameter. Has to be array or instance of Elastica\Filter');
+ } else {
+ $parsedArgs = array();
+ foreach ($args as $filter) {
+ if ($filter instanceof AbstractFilter) {
+ $parsedArgs[] = $filter->toArray();
+ }
+ }
+ $args = $parsedArgs;
+ }
+
+ $varName = '_'.$type;
+ $this->{$varName}[] = $args;
+
+ return $this;
+ }
+
+ /**
+ * Converts bool filter to array.
+ *
+ * @see \Elastica\Filter\AbstractFilter::toArray()
+ *
+ * @return array Filter array
+ */
+ public function toArray()
+ {
+ $args = array();
+
+ if (!empty($this->_must)) {
+ $args['bool']['must'] = $this->_must;
+ }
+
+ if (!empty($this->_should)) {
+ $args['bool']['should'] = $this->_should;
+ }
+
+ if (!empty($this->_mustNot)) {
+ $args['bool']['must_not'] = $this->_mustNot;
+ }
+
+ if (isset($args['bool'])) {
+ $args['bool'] = array_merge($args['bool'], $this->getParams());
+ }
+
+ return $args;
+ }
+}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/BoolNot.php b/vendor/ruflin/elastica/lib/Elastica/Filter/BoolNot.php
index 1778997b..81db7f65 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/BoolNot.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/BoolNot.php
@@ -1,19 +1,17 @@
<?php
-
namespace Elastica\Filter;
/**
- * Not Filter
+ * Not Filter.
*
- * @category Xodoa
- * @package Elastica
* @author Lee Parker, Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/not-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-not-filter.html
*/
class BoolNot extends AbstractFilter
{
/**
- * Creates Not filter query
+ * Creates Not filter query.
*
* @param \Elastica\Filter\AbstractFilter $filter Filter object
*/
@@ -23,10 +21,11 @@ class BoolNot extends AbstractFilter
}
/**
- * Set filter
+ * Set filter.
+ *
+ * @param \Elastica\Filter\AbstractFilter $filter
*
- * @param \Elastica\Filter\AbstractFilter $filter
- * @return \Elastica\Filter\BoolNot
+ * @return $this
*/
public function setFilter(AbstractFilter $filter)
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/BoolOr.php b/vendor/ruflin/elastica/lib/Elastica/Filter/BoolOr.php
index 6f63fc30..9091e496 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/BoolOr.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/BoolOr.php
@@ -1,14 +1,12 @@
<?php
-
namespace Elastica\Filter;
/**
- * Or Filter
+ * Or Filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/or-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-or-filter.html
*/
class BoolOr extends AbstractMulti
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Exists.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Exists.php
index 6fe43e3d..d6dc9962 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Exists.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Exists.php
@@ -1,19 +1,17 @@
<?php
-
namespace Elastica\Filter;
/**
- * Exists query
+ * Exists query.
*
- * @category Xodoa
- * @package Elastica
* @author Oleg Cherniy <oleg.cherniy@gmail.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/exists-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-filter.html
*/
class Exists extends AbstractFilter
{
/**
- * Construct exists filter
+ * Construct exists filter.
*
* @param string $field
*/
@@ -23,10 +21,11 @@ class Exists extends AbstractFilter
}
/**
- * Set field
+ * Set field.
+ *
+ * @param string $field
*
- * @param string $field
- * @return \Elastica\Filter\Exists
+ * @return $this
*/
public function setField($field)
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoBoundingBox.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoBoundingBox.php
index 1462e9af..f67febe3 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoBoundingBox.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoBoundingBox.php
@@ -1,21 +1,19 @@
<?php
-
namespace Elastica\Filter;
use Elastica\Exception\InvalidException;
/**
- * Geo bounding box filter
+ * Geo bounding box filter.
*
- * @category Xodoa
- * @package Elastica
* @author Fabian Vogler <fabian@equivalence.ch>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geo-bounding-box-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-filter.html
*/
class GeoBoundingBox extends AbstractFilter
{
/**
- * Construct BoundingBoxFilter
+ * Construct BoundingBoxFilter.
*
* @param string $key Key
* @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element
@@ -26,12 +24,14 @@ class GeoBoundingBox extends AbstractFilter
}
/**
- * Add coordinates
+ * Add coordinates.
+ *
+ * @param string $key Key
+ * @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element
+ *
+ * @throws \Elastica\Exception\InvalidException If $coordinates doesn't have two elements
*
- * @param string $key Key
- * @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element
- * @throws \Elastica\Exception\InvalidException If $coordinates doesn't have two elements
- * @return \Elastica\Filter\GeoBoundingBox Current object
+ * @return $this
*/
public function addCoordinates($key, array $coordinates)
{
@@ -41,7 +41,7 @@ class GeoBoundingBox extends AbstractFilter
$this->setParam($key, array(
'top_left' => $coordinates[0],
- 'bottom_right' => $coordinates[1]
+ 'bottom_right' => $coordinates[1],
));
return $this;
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php
index 8e875365..f4cb51d9 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistance.php
@@ -1,30 +1,30 @@
<?php
-
namespace Elastica\Filter;
/**
- * Geo distance filter
+ * Geo distance filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-filter.html
+ *
+ * @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
+ * 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
*
- * @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)
@@ -35,8 +35,9 @@ class GeoDistance extends AbstractGeoDistance
}
/**
- * @param string $distance
- * @return \Elastica\Filter\GeoDistance current filter
+ * @param string $distance
+ *
+ * @return $this
*/
public function setDistance($distance)
{
@@ -46,10 +47,11 @@ class GeoDistance extends AbstractGeoDistance
}
/**
- * See DISTANCE_TYPE_* constants
+ * See DISTANCE_TYPE_* constants.
+ *
+ * @param string $distanceType
*
- * @param string $distanceType
- * @return \Elastica\Filter\GeoDistance current filter
+ * @return $this
*/
public function setDistanceType($distanceType)
{
@@ -59,10 +61,11 @@ class GeoDistance extends AbstractGeoDistance
}
/**
- * See OPTIMIZE_BBOX_* constants
+ * See OPTIMIZE_BBOX_* constants.
+ *
+ * @param string $optimizeBbox
*
- * @param string $optimizeBbox
- * @return \Elastica\Filter\GeoDistance current filter
+ * @return $this
*/
public function setOptimizeBbox($optimizeBbox)
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistanceRange.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistanceRange.php
index 230e5ebf..f5cbbeb7 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistanceRange.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoDistanceRange.php
@@ -1,16 +1,14 @@
<?php
-
namespace Elastica\Filter;
use Elastica\Exception\InvalidException;
/**
- * Geo distance filter
+ * Geo distance filter.
*
- * @category Xodoa
- * @package Elastica
* @author munkie
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-range-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-range-filter.html
*/
class GeoDistanceRange extends AbstractGeoDistance
{
@@ -33,6 +31,7 @@ class GeoDistanceRange extends AbstractGeoDistance
* @param string $key
* @param array|string $location
* @param array $ranges
+ *
* @internal param string $distance
*/
public function __construct($key, $location, array $ranges = array())
@@ -45,8 +44,9 @@ class GeoDistanceRange extends AbstractGeoDistance
}
/**
- * @param array $ranges
- * @return \Elastica\Filter\GeoDistanceRange
+ * @param array $ranges
+ *
+ * @return $this
*/
public function setRanges(array $ranges)
{
@@ -60,10 +60,12 @@ class GeoDistanceRange extends AbstractGeoDistance
}
/**
- * @param string $key
- * @param mixed $value
- * @return \Elastica\Filter\GeoDistanceRange
+ * @param string $key
+ * @param mixed $value
+ *
* @throws \Elastica\Exception\InvalidException
+ *
+ * @return $this
*/
public function setRange($key, $value)
{
@@ -80,7 +82,7 @@ class GeoDistanceRange extends AbstractGeoDistance
$value = (boolean) $value;
break;
default:
- throw new InvalidException('Invalid range parameter given: ' . $key);
+ throw new InvalidException('Invalid range parameter given: '.$key);
}
$this->_ranges[$key] = $value;
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoPolygon.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoPolygon.php
index fa12c035..86ca2b80 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoPolygon.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoPolygon.php
@@ -1,35 +1,31 @@
<?php
-
namespace Elastica\Filter;
-use Elastica\Filter\AbstractFilter;
-
/**
- * Geo polygon filter
+ * Geo polygon filter.
*
- * @category Xodoa
- * @package Elastica
* @author Michael Maclean <mgdm@php.net>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geo-polygon-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-filter.html
*/
class GeoPolygon extends AbstractFilter
{
/**
- * Key
+ * Key.
*
* @var string Key
*/
protected $_key = '';
/**
- * Points making up polygon
+ * Points making up polygon.
*
* @var array Points making up polygon
*/
protected $_points = array();
/**
- * Construct polygon filter
+ * Construct polygon filter.
*
* @param string $key Key
* @param array $points Points making up polygon
@@ -41,9 +37,10 @@ class GeoPolygon extends AbstractFilter
}
/**
- * Converts filter to array
+ * Converts filter to array.
*
* @see \Elastica\Filter\AbstractFilter::toArray()
+ *
* @return array
*/
public function toArray()
@@ -51,9 +48,9 @@ class GeoPolygon extends AbstractFilter
return array(
'geo_polygon' => array(
$this->_key => array(
- 'points' => $this->_points
+ 'points' => $this->_points,
),
- )
+ ),
);
}
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapePreIndexed.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapePreIndexed.php
index 7e89f8a8..d07cffff 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapePreIndexed.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapePreIndexed.php
@@ -1,49 +1,47 @@
<?php
-
namespace Elastica\Filter;
/**
- * geo_shape filter for pre-indexed shapes
+ * geo_shape filter for pre-indexed shapes.
*
* Filter pre-indexed shape definitions
*
- * @category Xodoa
- * @package Elastica
* @author Bennie Krijger <benniekrijger@gmail.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geo-shape-filter/
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-filter.html
*/
class GeoShapePreIndexed extends AbstractGeoShape
{
/**
- * elasticsearch id of the pre-indexed shape
+ * elasticsearch id of the pre-indexed shape.
*
* @var string
*/
protected $_indexedId;
/**
- * elasticsearch type of the pre-indexed shape
+ * elasticsearch type of the pre-indexed shape.
*
* @var string
*/
protected $_indexedType;
/**
- * elasticsearch index of the pre-indexed shape
+ * elasticsearch index of the pre-indexed shape.
*
* @var string
*/
protected $_indexedIndex;
/**
- * elasticsearch path/field name of the pre-indexed shape
+ * elasticsearch path/field name of the pre-indexed shape.
*
* @var string
*/
protected $_indexedPath;
/**
- * Construct geo_shape filter with a pre-indexed shape
+ * Construct geo_shape filter with a pre-indexed shape.
*
* @param string $path The path/field of the shape searched
* @param string $indexedId Id of the pre-indexed shape
@@ -61,9 +59,10 @@ class GeoShapePreIndexed extends AbstractGeoShape
}
/**
- * Converts filter to array
+ * Converts filter to array.
*
* @see \Elastica\Filter\AbstractFilter::toArray()
+ *
* @return array
*/
public function toArray()
@@ -75,11 +74,11 @@ class GeoShapePreIndexed extends AbstractGeoShape
'id' => $this->_indexedId,
'type' => $this->_indexedType,
'index' => $this->_indexedIndex,
- 'path' => $this->_indexedPath
+ 'path' => $this->_indexedPath,
),
- 'relation' => $this->_relation
- )
- )
+ 'relation' => $this->_relation,
+ ),
+ ),
);
}
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapeProvided.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapeProvided.php
index 5a88c05f..0f25beeb 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapeProvided.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeoShapeProvided.php
@@ -1,42 +1,40 @@
<?php
-
namespace Elastica\Filter;
/**
- * geo_shape filter or provided shapes
+ * geo_shape filter or provided shapes.
*
* Filter provided shape definitions
*
- * @category Xodoa
- * @package Elastica
* @author BennieKrijger <benniekrijger@gmail.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geo-shape-filter/
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-filter.html
*/
class GeoShapeProvided extends AbstractGeoShape
{
- const TYPE_ENVELOPE = 'envelope';
- const TYPE_MULTIPOINT = 'multipoint';
- const TYPE_POINT = 'point';
- const TYPE_MULTIPOLYGON = 'multipolygon';
- const TYPE_LINESTRING = 'linestring';
- const TYPE_POLYGON = 'polygon';
+ const TYPE_ENVELOPE = 'envelope';
+ const TYPE_MULTIPOINT = 'multipoint';
+ const TYPE_POINT = 'point';
+ const TYPE_MULTIPOLYGON = 'multipolygon';
+ const TYPE_LINESTRING = 'linestring';
+ const TYPE_POLYGON = 'polygon';
/**
- * Type of the geo_shape
+ * Type of the geo_shape.
*
* @var string
*/
protected $_shapeType;
/**
- * Coordinates making up geo_shape
+ * Coordinates making up geo_shape.
*
* @var array Coordinates making up geo_shape
*/
protected $_coordinates;
/**
- * Construct geo_shape filter
+ * Construct geo_shape filter.
*
* @param string $path The path/field of the shape searched
* @param array $coordinates Points making up the shape
@@ -52,9 +50,10 @@ class GeoShapeProvided extends AbstractGeoShape
}
/**
- * Converts filter to array
+ * Converts filter to array.
*
* @see \Elastica\Filter\AbstractFilter::toArray()
+ *
* @return array
*/
public function toArray()
@@ -64,11 +63,11 @@ class GeoShapeProvided extends AbstractGeoShape
$this->_path => array(
'shape' => array(
'type' => $this->_shapeType,
- 'coordinates' => $this->_coordinates
+ 'coordinates' => $this->_coordinates,
),
- 'relation' => $this->_relation
+ 'relation' => $this->_relation,
),
- )
+ ),
);
}
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php b/vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php
index d14b25fe..dd147152 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/GeohashCell.php
@@ -1,20 +1,18 @@
<?php
-
namespace Elastica\Filter;
-
/**
- * Class GeohashCell
- * @package Elastica
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/geohash-cell-filter/
+ * Class GeohashCell.
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geohash-cell-filter.html
*/
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.
+ * @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 string|int $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)
{
@@ -24,9 +22,11 @@ class GeohashCell extends AbstractGeoDistance
}
/**
- * Set the precision for this filter
+ * Set the precision for this filter.
+ *
* @param string|int $precision Integer length of geohash prefix or distance (3, or "50m")
- * @return \Elastica\Filter\GeohashCell
+ *
+ * @return $this
*/
public function setPrecision($precision)
{
@@ -34,12 +34,14 @@ class GeohashCell extends AbstractGeoDistance
}
/**
- * Set the neighbors option for this filter
+ * Set the neighbors option for this filter.
+ *
* @param bool $neighbors If true, filters cells next to the given cell.
- * @return \Elastica\Filter\GeohashCell
+ *
+ * @return $this
*/
public function setNeighbors($neighbors)
{
- return $this->setParam('neighbors', (bool)$neighbors);
+ return $this->setParam('neighbors', (bool) $neighbors);
}
-} \ No newline at end of file
+}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/HasChild.php b/vendor/ruflin/elastica/lib/Elastica/Filter/HasChild.php
index e8c6ab96..2c4cc0d6 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/HasChild.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/HasChild.php
@@ -1,22 +1,20 @@
<?php
-
namespace Elastica\Filter;
/**
- * Returns parent documents having child docs matching the query
+ * Returns parent documents having child docs matching the query.
*
- * @category Xodoa
- * @package Elastica
* @author Fabian Vogler <fabian@equivalence.ch>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/has-child-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-filter.html
*/
class HasChild extends AbstractFilter
{
/**
- * Construct HasChild filter
+ * Construct HasChild filter.
*
* @param string|\Elastica\Query|\Elastica\Filter\AbstractFilter $query Query string or a Elastica\Query object or a filter
- * @param string $type Parent document type
+ * @param string|\Elastica\Type $type Child document type
*/
public function __construct($query, $type = null)
{
@@ -29,10 +27,11 @@ class HasChild extends AbstractFilter
}
/**
- * Sets query object
+ * Sets query object.
*
- * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query
- * @return \Elastica\Filter\HasChild Current object
+ * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query
+ *
+ * @return $this
*/
public function setQuery($query)
{
@@ -43,36 +42,54 @@ class HasChild extends AbstractFilter
}
/**
- * Sets the filter object
+ * Sets the filter object.
*
* @param \Elastica\Filter\AbstractFilter $filter
- * @return \Elastica\Filter\HasChild Current object
+ *
+ * @return $this
*/
public function setFilter($filter)
{
- $data = $filter->toArray();
- return $this->setParam('filter', $data);
+ return $this->setParam('filter', $filter->toArray());
}
/**
- * Set type of the parent document
+ * Set type of the child document.
*
- * @param string $type Parent document type
- * @return \Elastica\Filter\HasChild Current object
+ * @param string|\Elastica\Type $type Child document type
+ *
+ * @return $this
*/
public function setType($type)
{
- return $this->setParam('type', $type);
+ if ($type instanceof \Elastica\Type) {
+ $type = $type->getName();
+ }
+
+ return $this->setParam('type', (string) $type);
}
/**
- * Sets the scope
+ * Set minimum number of children are required to match for the parent doc to be considered a match.
+ *
+ * @param int $count
+ *
+ * @return $this
+ */
+ public function setMinimumChildrenCount($count)
+ {
+ return $this->setParam('min_children', (int) $count);
+ }
+
+ /**
+ * Set maximum number of children are required to match for the parent doc to be considered a match.
+ *
+ * @param int $count
*
- * @param string $scope Scope
- * @return \Elastica\Filter\HasChild Current object
+ * @return $this
*/
- public function setScope($scope)
+ public function setMaximumChildrenCount($count)
{
- return $this->setParam('_scope', $scope);
+ return $this->setParam('max_children', (int) $count);
}
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php b/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php
index de49e470..73a2dc5a 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php
@@ -1,21 +1,18 @@
<?php
-
namespace Elastica\Filter;
/**
- * Returns child documents having parent docs matching the query
+ * Returns child documents having parent docs matching the query.
*
- * @category Xodoa
- * @package Elastica
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/has-parent-filter.html
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-parent-filter.html
*/
class HasParent extends AbstractFilter
{
/**
- * Construct HasParent filter
+ * Construct HasParent filter.
*
* @param string|\Elastica\Query|\Elastica\Filter\AbstractFilter $query Query string or a Query object or a filter
- * @param string $type Parent document type
+ * @param string|\Elastica\Type $type Parent document type
*/
public function __construct($query, $type)
{
@@ -28,10 +25,11 @@ class HasParent extends AbstractFilter
}
/**
- * Sets query object
+ * Sets query object.
+ *
+ * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query
*
- * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query
- * @return \Elastica\Filter\HasParent Current object
+ * @return $this
*/
public function setQuery($query)
{
@@ -42,36 +40,30 @@ class HasParent extends AbstractFilter
}
/**
- * Sets query object
+ * Sets filter object.
+ *
+ * @param \Elastica\Filter\AbstractFilter $filter
*
- * @param \Elastica\Filter\AbstractFilter $filter
- * @return \Elastica\Filter\HasParent Current object
+ * @return $this
*/
public function setFilter($filter)
{
- $data = $filter->toArray();
- return $this->setParam('filter', $data);
+ return $this->setParam('filter', $filter->toArray());
}
/**
- * Set type of the parent document
+ * Set type of the parent document.
*
- * @param string $type Parent document type
- * @return \Elastica\Filter\HasParent Current object
+ * @param string|\Elastica\Type $type Parent document type
+ *
+ * @return $this
*/
public function setType($type)
{
- return $this->setParam('type', $type);
- }
+ if ($type instanceof \Elastica\Type) {
+ $type = $type->getName();
+ }
- /**
- * Sets the scope
- *
- * @param string $scope Scope
- * @return \Elastica\Filter\HasParent Current object
- */
- public function setScope($scope)
- {
- return $this->setParam('_scope', $scope);
+ return $this->setParam('type', (string) $type);
}
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Ids.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Ids.php
index fd1d9770..bfb8cc48 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Ids.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Ids.php
@@ -1,24 +1,22 @@
<?php
-
namespace Elastica\Filter;
use Elastica\Type as ElasticaType;
/**
- * Ids Filter
+ * Ids Filter.
*
- * @category Xodoa
- * @package Elastica
* @author Lee Parker, Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/ids-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-ids-filter.html
*/
class Ids extends AbstractFilter
{
/**
- * Creates filter object
+ * Creates filter object.
*
* @param string|\Elastica\Type $type Type to filter on
- * @param array $ids List of ids
+ * @param array $ids List of ids
*/
public function __construct($type = null, array $ids = array())
{
@@ -27,10 +25,11 @@ class Ids extends AbstractFilter
}
/**
- * Adds one more filter to the and filter
+ * Adds one more filter to the and filter.
+ *
+ * @param string $id Adds id to filter
*
- * @param string $id Adds id to filter
- * @return \Elastica\Filter\Ids Current object
+ * @return $this
*/
public function addId($id)
{
@@ -38,10 +37,11 @@ class Ids extends AbstractFilter
}
/**
- * Adds one more type to query
+ * Adds one more type to query.
*
- * @param string|\Elastica\Type $type Type name or object
- * @return \Elastica\Filter\Ids Current object
+ * @param string|\Elastica\Type $type Type name or object
+ *
+ * @return $this
*/
public function addType($type)
{
@@ -57,10 +57,11 @@ class Ids extends AbstractFilter
}
/**
- * Set type
+ * Set type.
+ *
+ * @param string|\Elastica\Type $type Type name or object
*
- * @param string|\Elastica\Type $type Type name or object
- * @return \Elastica\Filter\Ids Current object
+ * @return $this
*/
public function setType($type)
{
@@ -76,10 +77,11 @@ class Ids extends AbstractFilter
}
/**
- * Sets the ids to filter
+ * Sets the ids to filter.
+ *
+ * @param array|string $ids List of ids
*
- * @param array|string $ids List of ids
- * @return \Elastica\Filter\Ids Current object
+ * @return $this
*/
public function setIds($ids)
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
index 66ca5965..ffaf5975 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
@@ -1,18 +1,18 @@
<?php
-
namespace Elastica\Filter;
+use Elastica\Index as ElasticaIndex;
/**
- * Class Indices
- * @package Elastica\Filter
- * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/query-dsl-indices-filter.html
+ * Class Indices.
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-indices-filter.html
*/
class Indices extends AbstractFilter
{
/**
- * @param AbstractFilter $filter filter which will be applied to docs in the specified indices
- * @param string[] $indices
+ * @param AbstractFilter $filter filter which will be applied to docs in the specified indices
+ * @param mixed[] $indices
*/
public function __construct(AbstractFilter $filter, array $indices)
{
@@ -20,19 +20,44 @@ class Indices extends AbstractFilter
}
/**
- * Set the names of the indices on which this filter should be applied
- * @param string[] $indices
- * @return Indices
+ * Set the indices on which this filter should be applied.
+ *
+ * @param mixed[] $indices
+ *
+ * @return $this
*/
public function setIndices(array $indices)
{
- return $this->setParam('indices', $indices);
+ $this->setParam('indices', array());
+ foreach ($indices as $index) {
+ $this->addIndex($index);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Adds one more index on which this filter should be applied.
+ *
+ * @param string|\Elastica\Index $index
+ *
+ * @return $this
+ */
+ public function addIndex($index)
+ {
+ if ($index instanceof ElasticaIndex) {
+ $index = $index->getName();
+ }
+
+ return $this->addParam('indices', (string) $index);
}
/**
- * Set the filter to be applied to docs in the specified indices
+ * Set the filter to be applied to docs in the specified indices.
+ *
* @param AbstractFilter $filter
- * @return Indices
+ *
+ * @return $this
*/
public function setFilter(AbstractFilter $filter)
{
@@ -40,12 +65,14 @@ class Indices extends AbstractFilter
}
/**
- * Set the filter to be applied to docs in indices which do not match those specified in the "indices" parameter
+ * Set the filter to be applied to docs in indices which do not match those specified in the "indices" parameter.
+ *
* @param AbstractFilter $filter
- * @return Indices
+ *
+ * @return $this
*/
public function setNoMatchFilter(AbstractFilter $filter)
{
return $this->setParam('no_match_filter', $filter->toArray());
}
-} \ No newline at end of file
+}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Limit.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Limit.php
index e02853ae..bf3f8e13 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Limit.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Limit.php
@@ -1,22 +1,19 @@
<?php
-
namespace Elastica\Filter;
/**
- * Limit Filter
+ * Limit Filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/limit-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-limit-filter.html
*/
class Limit extends AbstractFilter
{
/**
- * Construct limit filter
+ * Construct limit filter.
*
- * @param int $limit Limit
- * @return \Elastica\Filter\Limit
+ * @param int $limit Limit
*/
public function __construct($limit)
{
@@ -24,10 +21,11 @@ class Limit extends AbstractFilter
}
/**
- * Set the limit
+ * Set the limit.
+ *
+ * @param int $limit Limit
*
- * @param int $limit Limit
- * @return \Elastica\Filter\Limit
+ * @return $this
*/
public function setLimit($limit)
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/MatchAll.php b/vendor/ruflin/elastica/lib/Elastica/Filter/MatchAll.php
index a69b65a2..607c5fd1 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/MatchAll.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/MatchAll.php
@@ -1,19 +1,17 @@
<?php
-
namespace Elastica\Filter;
/**
- * Match all filter
+ * Match all filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/match-all-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-filter.html
*/
class MatchAll extends AbstractFilter
{
/**
- * Creates match all filter
+ * Creates match all filter.
*/
public function __construct()
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Missing.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Missing.php
index df8466a8..9b157b2c 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Missing.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Missing.php
@@ -1,19 +1,17 @@
<?php
-
namespace Elastica\Filter;
/**
- * Missing Filter
+ * Missing Filter.
*
- * @category Xodoa
- * @package Elastica
* @author Maciej Wiercinski <maciej@wiercinski.net>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/missing-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-missing-filter.html
*/
class Missing extends AbstractFilter
{
/**
- * Construct missing filter
+ * Construct missing filter.
*
* @param string $field OPTIONAL
*/
@@ -25,13 +23,38 @@ class Missing extends AbstractFilter
}
/**
- * Set field
+ * Set field.
+ *
+ * @param string $field
*
- * @param string $field
- * @return \Elastica\Filter\Missing
+ * @return $this
*/
public function setField($field)
{
return $this->setParam('field', (string) $field);
}
+
+ /**
+ * Set "existence" parameter.
+ *
+ * @param bool $existence
+ *
+ * @return $this
+ */
+ public function setExistence($existence)
+ {
+ return $this->setParam('existence', (bool) $existence);
+ }
+
+ /**
+ * Set "null_value" parameter.
+ *
+ * @param bool $nullValue
+ *
+ * @return $this
+ */
+ public function setNullValue($nullValue)
+ {
+ return $this->setParam('null_value', (bool) $nullValue);
+ }
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Nested.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Nested.php
index 16293519..ad21bc7e 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Nested.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Nested.php
@@ -1,24 +1,23 @@
<?php
-
namespace Elastica\Filter;
use Elastica\Query\AbstractQuery;
/**
- * Nested filter
+ * Nested filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/nested-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-filter.html
*/
class Nested extends AbstractFilter
{
/**
- * Adds field to mlt filter
+ * Adds field to mlt filter.
+ *
+ * @param string $path Nested object path
*
- * @param string $path Nested object path
- * @return \Elastica\Filter\Nested
+ * @return $this
*/
public function setPath($path)
{
@@ -26,10 +25,11 @@ class Nested extends AbstractFilter
}
/**
- * Sets nested query
+ * Sets nested query.
*
- * @param \Elastica\Query\AbstractQuery $query
- * @return \Elastica\Filter\Nested
+ * @param \Elastica\Query\AbstractQuery $query
+ *
+ * @return $this
*/
public function setQuery(AbstractQuery $query)
{
@@ -37,10 +37,11 @@ class Nested extends AbstractFilter
}
/**
- * Sets nested filter
+ * Sets nested filter.
+ *
+ * @param \Elastica\Filter\AbstractFilter $filter
*
- * @param \Elastica\Filter\AbstractFilter $filter
- * @return \Elastica\Filter\Nested
+ * @return $this
*/
public function setFilter(AbstractFilter $filter)
{
@@ -48,13 +49,14 @@ class Nested extends AbstractFilter
}
/**
- * Set score mode
+ * Set join option.
+ *
+ * @param bool $join
*
- * @param string $scoreMode Options: avg, total, max and none.
- * @return \Elastica\Filter\Nested
+ * @return $this
*/
- public function setScoreMode($scoreMode)
+ public function setJoin($join)
{
- return $this->setParam('score_mode', $scoreMode);
+ return $this->setParam('join', (bool) $join);
}
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/NumericRange.php b/vendor/ruflin/elastica/lib/Elastica/Filter/NumericRange.php
index 5a6e2551..08342616 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/NumericRange.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/NumericRange.php
@@ -1,14 +1,12 @@
<?php
-
namespace Elastica\Filter;
/**
- * Numeric Range Filter
+ * Numeric Range Filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/numeric-range-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-filter.html
*/
class NumericRange extends Range
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Prefix.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Prefix.php
index 2caf13cb..e845fd73 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Prefix.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Prefix.php
@@ -1,14 +1,12 @@
<?php
-
namespace Elastica\Filter;
/**
- * Prefix filter
+ * Prefix filter.
*
- * @category Xodoa
- * @package Elastica
* @author Jasper van Wanrooy <jasper@vanwanrooy.net>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/prefix-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-filter.html
*/
class Prefix extends AbstractFilter
{
@@ -27,7 +25,7 @@ class Prefix extends AbstractFilter
protected $_prefix = '';
/**
- * Creates prefix filter
+ * Creates prefix filter.
*
* @param string $field Field name
* @param string $prefix Prefix string
@@ -41,8 +39,9 @@ class Prefix extends AbstractFilter
/**
* Sets the name of the prefix field.
*
- * @param string $field Field name
- * @return \Elastica\Filter\Prefix
+ * @param string $field Field name
+ *
+ * @return $this
*/
public function setField($field)
{
@@ -54,8 +53,9 @@ class Prefix extends AbstractFilter
/**
* Sets the prefix string.
*
- * @param string $prefix Prefix string
- * @return \Elastica\Filter\Prefix
+ * @param string $prefix Prefix string
+ *
+ * @return $this
*/
public function setPrefix($prefix)
{
@@ -65,9 +65,10 @@ class Prefix extends AbstractFilter
}
/**
- * Converts object to an array
+ * Converts object to an array.
*
* @see \Elastica\Filter\AbstractFilter::toArray()
+ *
* @return array data array
*/
public function toArray()
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Query.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Query.php
index 3f1ba2d2..acb6a124 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Query.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Query.php
@@ -1,28 +1,27 @@
<?php
-
namespace Elastica\Filter;
use Elastica\Exception\InvalidException;
use Elastica\Query\AbstractQuery;
/**
- * Query filter
+ * Query filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/query-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-filter.html
*/
class Query extends AbstractFilter
{
/**
- * Query
+ * Query.
+ *
* @var array
*/
protected $_query;
/**
- * Construct query filter
+ * Construct query filter.
*
* @param array|\Elastica\Query\AbstractQuery $query
*/
@@ -34,15 +33,17 @@ class Query extends AbstractFilter
}
/**
- * Set query
+ * Set query.
+ *
+ * @param array|\Elastica\Query\AbstractQuery $query
+ *
+ * @throws \Elastica\Exception\InvalidException If parameter is invalid
*
- * @param array|\Elastica\Query\AbstractQuery $query
- * @return \Elastica\Filter\Query Query object
- * @throws \Elastica\Exception\InvalidException Invalid param
+ * @return $this
*/
public function setQuery($query)
{
- if (!$query instanceof AbstractQuery && ! is_array($query)) {
+ if (!$query instanceof AbstractQuery && !is_array($query)) {
throw new InvalidException('expected an array or instance of Elastica\Query\AbstractQuery');
}
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();
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Regexp.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Regexp.php
index 33c47cfd..612dc434 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Regexp.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Regexp.php
@@ -1,14 +1,12 @@
<?php
-
namespace Elastica\Filter;
/**
- * Regexp filter
+ * Regexp filter.
*
- * @category Xodoa
- * @package Elastica
* @author Timothy Lamb <trash80@gmail.com>
- * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-regexp-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-filter.html
*/
class Regexp extends AbstractFilter
{
@@ -27,23 +25,34 @@ class Regexp extends AbstractFilter
protected $_regexp = '';
/**
- * Create Regexp object
+ * Holds the regexp options.
+ *
+ * @var array
+ */
+ protected $_options = array();
+
+ /**
+ * Create Regexp object.
+ *
+ * @param string $field Field name
+ * @param string $regexp Regular expression
+ * @param array $options Regular expression options
*
- * @param string $field Field name
- * @param string $regexp Regular expression
* @throws \Elastica\Exception\InvalidException
*/
- public function __construct($field = '', $regexp = '')
+ public function __construct($field = '', $regexp = '', $options = array())
{
$this->setField($field);
$this->setRegexp($regexp);
+ $this->setOptions($options);
}
/**
* Sets the name of the regexp field.
*
- * @param string $field Field name
- * @return \Elastica\Filter\Regexp
+ * @param string $field Field name
+ *
+ * @return $this
*/
public function setField($field)
{
@@ -55,8 +64,9 @@ class Regexp extends AbstractFilter
/**
* Sets the regular expression query string.
*
- * @param string $regexp Regular expression
- * @return \Elastica\Filter\Regexp
+ * @param string $regexp Regular expression
+ *
+ * @return $this
*/
public function setRegexp($regexp)
{
@@ -66,14 +76,36 @@ class Regexp extends AbstractFilter
}
/**
- * Converts object to an array
+ * Sets the regular expression query options.
+ *
+ * @param array $options Regular expression options
+ *
+ * @return $this
+ */
+ public function setOptions($options)
+ {
+ $this->_options = $options;
+
+ return $this;
+ }
+
+ /**
+ * Converts object to an array.
*
* @see \Elastica\Filter\AbstractFilter::toArray()
+ *
* @return array data array
*/
public function toArray()
{
- $this->setParam($this->_field, $this->_regexp);
+ if (count($this->_options) > 0) {
+ $options = array('value' => $this->_regexp);
+ $options = array_merge($options, $this->_options);
+
+ $this->setParam($this->_field, $options);
+ } else {
+ $this->setParam($this->_field, $this->_regexp);
+ }
return parent::toArray();
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Script.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Script.php
index 9b34b1ec..2c8d34bf 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Script.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Script.php
@@ -1,29 +1,26 @@
<?php
-
namespace Elastica\Filter;
use Elastica;
-use Elastica\Query\AbstractQuery;
/**
- * Script filter
+ * Script filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/script-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html
*/
class Script extends AbstractFilter
{
/**
- * Query object
+ * Query object.
*
* @var array|\Elastica\Query\AbstractQuery
*/
protected $_query = null;
/**
- * Construct script filter
+ * Construct script filter.
*
* @param array|string|\Elastica\Script $script OPTIONAL Script
*/
@@ -35,10 +32,11 @@ class Script extends AbstractFilter
}
/**
- * Sets script object
+ * Sets script object.
+ *
+ * @param \Elastica\Script|string|array $script
*
- * @param \Elastica\Script|string|array $script
- * @return \Elastica\Filter\Script
+ * @return $this
*/
public function setScript($script)
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Term.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Term.php
index b4773030..2a387318 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Term.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Term.php
@@ -1,19 +1,17 @@
<?php
-
namespace Elastica\Filter;
/**
- * Term query
+ * Term query.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/term-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-filter.html
*/
class Term extends AbstractFilter
{
/**
- * Construct term filter
+ * Construct term filter.
*
* @param array $term Term array
*/
@@ -23,10 +21,11 @@ class Term extends AbstractFilter
}
/**
- * Sets/overwrites key and term directly
+ * Sets/overwrites key and term directly.
*
- * @param array $term Key value pair
- * @return \Elastica\Filter\Term Filter object
+ * @param array $term Key value pair
+ *
+ * @return $this
*/
public function setRawTerm(array $term)
{
@@ -34,11 +33,12 @@ class Term extends AbstractFilter
}
/**
- * Adds a term to the term query
+ * Adds a term to the term query.
+ *
+ * @param string $key Key to query
+ * @param string|array $value Values(s) for the query. Boost can be set with array
*
- * @param string $key Key to query
- * @param string|array $value Values(s) for the query. Boost can be set with array
- * @return \Elastica\Filter\Term Filter object
+ * @return $this
*/
public function setTerm($key, $value)
{
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Terms.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Terms.php
index 2f7c88e3..c099ab3d 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Terms.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Terms.php
@@ -1,42 +1,40 @@
<?php
-
namespace Elastica\Filter;
use Elastica\Exception\InvalidException;
/**
- * Terms filter
+ * Terms filter.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/terms-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-filter.html
*/
class Terms extends AbstractFilter
{
/**
- * Terms
+ * Terms.
*
* @var array Terms
*/
protected $_terms = array();
/**
- * Params
+ * Params.
*
* @var array Params
*/
protected $_params = array();
/**
- * Terms key
+ * Terms key.
*
* @var string Terms key
*/
protected $_key = '';
/**
- * Creates terms filter
+ * Creates terms filter.
*
* @param string $key Terms key
* @param array $terms Terms values
@@ -47,11 +45,12 @@ class Terms extends AbstractFilter
}
/**
- * Sets key and terms for the filter
+ * Sets key and terms for the filter.
*
- * @param string $key Terms key
- * @param array $terms Terms for the query.
- * @return \Elastica\Filter\Terms
+ * @param string $key Terms key
+ * @param array $terms Terms for the query.
+ *
+ * @return $this
*/
public function setTerms($key, array $terms)
{
@@ -62,13 +61,15 @@ class Terms extends AbstractFilter
}
/**
- * Set the lookup parameters for this filter
- * @param string $key terms key
- * @param string|\Elastica\Type $type document type from which to fetch the terms values
- * @param string $id id of the document from which to fetch the terms values
- * @param string $path the field from which to fetch the values for the filter
+ * Set the lookup parameters for this filter.
+ *
+ * @param string $key terms key
+ * @param string|\Elastica\Type $type document type from which to fetch the terms values
+ * @param string $id id of the document from which to fetch the terms values
+ * @param string $path the field from which to fetch the values for the filter
* @param string|array|\Elastica\Index $options An array of options or the index from which to fetch the terms values. Defaults to the current index.
- * @return \Elastica\Filter\Terms Filter object
+ *
+ * @return $this
*/
public function setLookup($key, $type, $id, $path, $options = array())
{
@@ -79,32 +80,34 @@ class Terms extends AbstractFilter
$this->_terms = array(
'type' => $type,
'id' => $id,
- 'path' => $path
+ 'path' => $path,
);
-
+
$index = $options;
- if(is_array($options)) {
- if(isset($options['index'])) {
+ if (is_array($options)) {
+ if (isset($options['index'])) {
$index = $options['index'];
unset($options['index']);
}
$this->_terms = array_merge($options, $this->_terms);
}
-
+
if (!is_null($index)) {
if ($index instanceof \Elastica\Index) {
$index = $index->getName();
}
$this->_terms['index'] = $index;
}
+
return $this;
}
/**
- * Adds an additional term to the query
+ * Adds an additional term to the query.
+ *
+ * @param string $term Filter term
*
- * @param string $term Filter term
- * @return \Elastica\Filter\Terms Filter object
+ * @return $this
*/
public function addTerm($term)
{
@@ -114,11 +117,13 @@ class Terms extends AbstractFilter
}
/**
- * Converts object to an array
+ * Converts object to an array.
*
* @see \Elastica\Filter\AbstractFilter::toArray()
+ *
* @throws \Elastica\Exception\InvalidException
- * @return array data array
+ *
+ * @return array
*/
public function toArray()
{
@@ -129,4 +134,16 @@ class Terms extends AbstractFilter
return array('terms' => $this->_params);
}
+
+ /**
+ * Set execution mode.
+ *
+ * @param string $execution Options: "bool", "and", "or", "plain" or "fielddata"
+ *
+ * @return $this
+ */
+ public function setExecution($execution)
+ {
+ return $this->setParam('execution', (string) $execution);
+ }
}
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Type.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Type.php
index 8fb58c7d..f9c17813 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Type.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Type.php
@@ -1,42 +1,40 @@
<?php
-
namespace Elastica\Filter;
/**
- * Type Filter
+ * Type Filter.
*
- * @category Xodoa
- * @package Elastica
* @author James Wilson <jwilson556@gmail.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/type-filter.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-type-filter.html
*/
class Type extends AbstractFilter
{
/**
- * Type name
+ * Type name.
*
* @var string
*/
protected $_type = null;
/**
- * Construct Type Filter
+ * Construct Type Filter.
*
- * @param string $typeName Type name
- * @return \Elastica\Filter\Type
+ * @param string $type Type name
*/
- public function __construct($typeName = null)
+ public function __construct($type = null)
{
- if ($typeName) {
- $this->setType($typeName);
+ if ($type) {
+ $this->setType($type);
}
}
/**
- * Ads a field with arguments to the range query
+ * Ads a field with arguments to the range query.
*
- * @param string $typeName Type name
- * @return \Elastica\Filter\Type current object
+ * @param string $typeName Type name
+ *
+ * @return $this
*/
public function setType($typeName)
{
@@ -46,15 +44,16 @@ class Type extends AbstractFilter
}
/**
- * Convert object to array
+ * Convert object to array.
*
* @see \Elastica\Filter\AbstractFilter::toArray()
+ *
* @return array Filter array
*/
public function toArray()
{
return array(
- 'type' => array('value' => $this->_type)
+ 'type' => array('value' => $this->_type),
);
}
}