diff options
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php b/vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php deleted file mode 100644 index c28d4cdd..00000000 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php - -namespace Elastica\Query; - -use Elastica\Filter\AbstractFilter; -use Elastica\Exception\InvalidException; - -/** - * Filtered query. Needs a query and a filter - * - * @category Xodoa - * @package Elastica - * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html - */ -class Filtered extends AbstractQuery -{ - /** - * Constructs a filtered query - * - * @param \Elastica\Query\AbstractQuery $query OPTIONAL Query object - * @param \Elastica\Filter\AbstractFilter $filter OPTIONAL Filter object - */ - public function __construct(AbstractQuery $query = null, AbstractFilter $filter = null) { - $this->setQuery($query); - $this->setFilter($filter); - } - - /** - * Sets a query - * - * @param \Elastica\Query\AbstractQuery $query Query object - * @return \Elastica\Query\Filtered Current object - */ - public function setQuery(AbstractQuery $query = null) - { - return $this->setParam('query', $query); - } - - /** - * Sets the filter - * - * @param \Elastica\Filter\AbstractFilter $filter Filter object - * @return \Elastica\Query\Filtered Current object - */ - public function setFilter(AbstractFilter $filter = null) - { - return $this->setParam('filter', $filter); - } - - /** - * Gets the filter. - * - * @return \Elastica\Filter\AbstractFilter - */ - public function getFilter() - { - return $this->getParam('filter'); - } - - /** - * Gets the query. - * - * @return \Elastica\Query\AbstractQuery - */ - public function getQuery() - { - return $this->getParam('query'); - } - - /** - * Converts query to array - * - * @return array Query array - * @see \Elastica\Query\AbstractQuery::toArray() - */ - public function toArray() - { - $filtered = array(); - - if ($this->hasParam('query') && $this->getParam('query') instanceof AbstractQuery) { - $filtered['query'] = $this->getParam('query')->toArray(); - } - - if ($this->hasParam('filter') && $this->getParam('filter') instanceof AbstractFilter) { - $filtered['filter'] = $this->getParam('filter')->toArray(); - } - - if (empty($filtered)) { - throw new InvalidException('A query and/or filter is required'); - } - - return array('filtered' => $filtered); - } -} |