From 15e69f7b20b6596b9148030acce5b59993b95a45 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Dec 2015 06:00:00 +0100 Subject: Update to MediaWiki 1.25.4 --- vendor/ruflin/elastica/lib/Elastica/Query/Bool.php | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 vendor/ruflin/elastica/lib/Elastica/Query/Bool.php (limited to 'vendor/ruflin/elastica/lib/Elastica/Query/Bool.php') diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php b/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php new file mode 100644 index 00000000..2b2c1157 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php @@ -0,0 +1,92 @@ + + * @link http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html + */ +class Bool extends AbstractQuery +{ + /** + * Add should part to query + * + * @param \Elastica\Query\AbstractQuery|array $args Should query + * @return \Elastica\Query\Bool Current object + */ + public function addShould($args) + { + return $this->_addQuery('should', $args); + } + + /** + * Add must part to query + * + * @param \Elastica\Query\AbstractQuery|array $args Must query + * @return \Elastica\Query\Bool Current object + */ + public function addMust($args) + { + return $this->_addQuery('must', $args); + } + + /** + * Add must not part to query + * + * @param \Elastica\Query\AbstractQuery|array $args Must not query + * @return \Elastica\Query\Bool Current object + */ + public function addMustNot($args) + { + return $this->_addQuery('must_not', $args); + } + + /** + * Adds a query to the current object + * + * @param string $type Query type + * @param \Elastica\Query\AbstractQuery|array $args Query + * @return \Elastica\Query\Bool + * @throws \Elastica\Exception\InvalidException If not valid query + */ + protected function _addQuery($type, $args) + { + if ($args instanceof AbstractQuery) { + $args = $args->toArray(); + } + + if (!is_array($args)) { + throw new InvalidException('Invalid parameter. Has to be array or instance of Elastica\Query\AbstractQuery'); + } + + return $this->addParam($type, $args); + } + + /** + * Sets boost value of this query + * + * @param float $boost Boost value + * @return \Elastica\Query\Bool Current object + */ + public function setBoost($boost) + { + return $this->setParam('boost', $boost); + } + + /** + * Set the minimum number of of should match + * + * @param int $minimumNumberShouldMatch Should match minimum + * @return \Elastica\Query\Bool Current object + */ + public function setMinimumNumberShouldMatch($minimumNumberShouldMatch) + { + return $this->setParam('minimum_number_should_match', $minimumNumberShouldMatch); + } +} -- cgit v1.2.3-54-g00ecf