diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /vendor/ruflin/elastica/lib/Elastica/Query | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Query')
33 files changed, 1300 insertions, 803 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/AbstractQuery.php b/vendor/ruflin/elastica/lib/Elastica/Query/AbstractQuery.php index 5b24ace4..fd1c29b0 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/AbstractQuery.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/AbstractQuery.php @@ -1,13 +1,11 @@ <?php - namespace Elastica\Query; + use Elastica\Param; /** * Abstract query object. Should be extended by all query types. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ abstract class AbstractQuery extends Param diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php b/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php index 2b2c1157..c5bccc54 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Bool.php @@ -1,92 +1,15 @@ <?php - namespace Elastica\Query; -use Elastica\Exception\InvalidException; -use Elastica\Query\AbstractQuery; /** - * Bool query + * Bool query. + * + * 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-query.html */ -class Bool extends AbstractQuery +class Bool extends BoolQuery { - /** - * 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); - } } diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/BoolQuery.php b/vendor/ruflin/elastica/lib/Elastica/Query/BoolQuery.php new file mode 100644 index 00000000..7b8bd4da --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Query/BoolQuery.php @@ -0,0 +1,111 @@ +<?php +namespace Elastica\Query; + +use Elastica\Exception\InvalidException; + +/** + * Bool query. + * + * @author Nicolas Ruflin <spam@ruflin.com> + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html + */ +class BoolQuery extends AbstractQuery +{ + /** + * Add should part to query. + * + * @param \Elastica\Query\AbstractQuery|array $args Should query + * + * @return $this + */ + public function addShould($args) + { + return $this->_addQuery('should', $args); + } + + /** + * Add must part to query. + * + * @param \Elastica\Query\AbstractQuery|array $args Must query + * + * @return $this + */ + 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 $this + */ + 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 + * + * @throws \Elastica\Exception\InvalidException If not valid query + * + * @return $this + */ + 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 $this + */ + public function setBoost($boost) + { + return $this->setParam('boost', $boost); + } + + /** + * Set the minimum number of of should match. + * + * @param int $minimumNumberShouldMatch Should match minimum + * + * @return $this + */ + public function setMinimumNumberShouldMatch($minimumNumberShouldMatch) + { + return $this->setParam('minimum_number_should_match', $minimumNumberShouldMatch); + } + + /** + * Converts array to an object in case no queries are added. + * + * @return array + */ + public function toArray() + { + if (empty($this->_params)) { + $this->_params = new \stdClass(); + } + + return parent::toArray(); + } +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Boosting.php b/vendor/ruflin/elastica/lib/Elastica/Query/Boosting.php index fe429637..95dcde3d 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Boosting.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Boosting.php @@ -1,21 +1,23 @@ <?php - namespace Elastica\Query; /** - * Class Boosting - * @package Elastica\Query + * Class Boosting. + * * @author Balazs Nadasdi <yitsushi@gmail.com> - * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html */ class Boosting extends AbstractQuery { const NEGATIVE_BOOST = 0.2; /** - * Set the positive query for this Boosting Query + * Set the positive query for this Boosting Query. + * * @param AbstractQuery $query - * @return \Elastica\Query\Boosting + * + * @return $this */ public function setPositiveQuery(AbstractQuery $query) { @@ -23,9 +25,11 @@ class Boosting extends AbstractQuery } /** - * Set the negative query for this Boosting Query + * Set the negative query for this Boosting Query. + * * @param AbstractQuery $query - * @return \Elastica\Query\Boosting + * + * @return $this */ public function setNegativeQuery(AbstractQuery $query) { @@ -33,12 +37,14 @@ class Boosting extends AbstractQuery } /** - * Set the negative_boost parameter for this Boosting Query + * Set the negative_boost parameter for this Boosting Query. + * * @param Float $negativeBoost - * @return \Elastica\Query\Boosting + * + * @return $this */ public function setNegativeBoost($negativeBoost) { - return $this->setParam('negative_boost', (float)$negativeBoost); + return $this->setParam('negative_boost', (float) $negativeBoost); } } diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Builder.php b/vendor/ruflin/elastica/lib/Elastica/Query/Builder.php index 2a5e8baa..55b6b903 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Builder.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Builder.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Query; use Elastica\Exception\InvalidException; @@ -9,10 +8,10 @@ use Elastica\JSON; /** * Query Builder. * - * @category Xodoa - * @package Elastica * @author Chris Gedrim <chris@gedr.im> - * @link http://www.elasticsearch.org/ + * + * @link http://www.elastic.co/ + * @deprecated This builder is deprecated and will be removed. Use new Elastica\QueryBuilder instead. **/ class Builder extends AbstractQuery { @@ -28,21 +27,21 @@ class Builder extends AbstractQuery * * @param string $string JSON encoded string to use as query. * - * @return \Elastica\Query\Builder + * @return self */ public static function factory($string = null) { - return new Builder($string); + return new self($string); } /** - * Constructor + * Constructor. * * @param string $string JSON encoded string to use as query. */ public function __construct($string = null) { - if (! $string == null) { + if (!$string == null) { $this->_string .= substr($string, 1, -1); } } @@ -63,18 +62,21 @@ class Builder extends AbstractQuery public function toArray() { try { - return JSON::parse($this->__toString()); + return JSON::parse($input = $this->__toString()); } catch (JSONParseException $e) { - throw new InvalidException('The query produced is invalid'); + throw new InvalidException(sprintf( + 'The produced query is not a valid json string : "%s"', + $input + )); } } /** * Allow wildcards (*, ?) as the first character in a query. * - * @param boolean $bool Defaults to true. + * @param bool $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function allowLeadingWildcard($bool = true) { @@ -84,9 +86,9 @@ class Builder extends AbstractQuery /** * Enable best effort analysis of wildcard terms. * - * @param boolean $bool Defaults to true. + * @param bool $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function analyzeWildcard($bool = true) { @@ -98,7 +100,7 @@ class Builder extends AbstractQuery * * @param string $analyzer Analyzer to use. * - * @return \Elastica\Query\Builder + * @return $this */ public function analyzer($analyzer) { @@ -108,9 +110,9 @@ class Builder extends AbstractQuery /** * Autogenerate phrase queries. * - * @param boolean $bool Defaults to true. + * @param bool $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function autoGeneratePhraseQueries($bool = true) { @@ -129,7 +131,7 @@ class Builder extends AbstractQuery * * The occurrence types are: must, should, must_not. * - * @return \Elastica\Query\Builder + * @return $this */ public function bool() { @@ -141,7 +143,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function boolClose() { @@ -153,7 +155,7 @@ class Builder extends AbstractQuery * * @param float $boost Defaults to 1.0. * - * @return \Elastica\Query\Builder + * @return $this */ public function boost($boost = 1.0) { @@ -163,7 +165,7 @@ class Builder extends AbstractQuery /** * Close a previously opened brace. * - * @return \Elastica\Query\Builder + * @return $this */ public function close() { @@ -180,7 +182,7 @@ class Builder extends AbstractQuery * * Maps to Lucene ConstantScoreQuery. * - * @return \Elastica\Query\Builder + * @return $this */ public function constantScore() { @@ -192,7 +194,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function constantScoreClose() { @@ -204,7 +206,7 @@ class Builder extends AbstractQuery * * @param string $field Defaults to _all. * - * @return \Elastica\Query\Builder + * @return $this */ public function defaultField($field = '_all') { @@ -220,7 +222,7 @@ class Builder extends AbstractQuery * * @param string $operator Defaults to OR. * - * @return \Elastica\Query\Builder + * @return $this */ public function defaultOperator($operator = 'OR') { @@ -235,7 +237,7 @@ class Builder extends AbstractQuery * produced by any subquery, plus a tie breaking increment for any additional * matching subqueries. * - * @return \Elastica\Query\Builder + * @return $this */ public function disMax() { @@ -247,7 +249,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function disMaxClose() { @@ -257,9 +259,9 @@ class Builder extends AbstractQuery /** * Enable position increments in result queries. * - * @param boolean $bool Defaults to true. + * @param bool $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function enablePositionIncrements($bool = true) { @@ -269,9 +271,9 @@ class Builder extends AbstractQuery /** * Enables explanation for each hit on how its score was computed. * - * @param boolean $value Turn on / off explain. + * @param bool $value Turn on / off explain. * - * @return \Elastica\Query\Builder + * @return $this */ public function explain($value = true) { @@ -289,7 +291,7 @@ class Builder extends AbstractQuery * Elasticsearch supports more advanced facet implementations, such as * statistical or date histogram facets. * - * @return \Elastica\Query\Builder + * @return $this */ public function facets() { @@ -301,7 +303,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function facetsClose() { @@ -314,12 +316,12 @@ class Builder extends AbstractQuery * @param string $name Field to add. * @param mixed $value Value to set. * - * @return \Elastica\Query\Builder + * @return $this */ public function field($name, $value) { if (is_bool($value)) { - $value = '"'. var_export($value, true) . '"'; + $value = '"'.var_export($value, true).'"'; } elseif (is_array($value)) { $value = '["'.implode('","', $value).'"]'; } else { @@ -348,7 +350,7 @@ class Builder extends AbstractQuery * ->rangeClose() * ->queryClose(); * - * @return \Elastica\Query\Builder + * @return $this */ public function fieldClose() { @@ -360,7 +362,7 @@ class Builder extends AbstractQuery * * @param string $name Field name. * - * @return \Elastica\Query\Builder + * @return $this */ public function fieldOpen($name) { @@ -375,7 +377,7 @@ class Builder extends AbstractQuery * * @param array $fields Array of fields to return. * - * @return \Elastica\Query\Builder + * @return $this */ public function fields(array $fields) { @@ -393,7 +395,7 @@ class Builder extends AbstractQuery /** * Open a 'filter' block. * - * @return \Elastica\Query\Builder + * @return $this */ public function filter() { @@ -403,7 +405,7 @@ class Builder extends AbstractQuery /** * Close a filter block. * - * @return \Elastica\Query\Builder + * @return $this */ public function filterClose() { @@ -413,7 +415,7 @@ class Builder extends AbstractQuery /** * Query. * - * @return \Elastica\Query\Builder + * @return $this */ public function filteredQuery() { @@ -425,7 +427,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function filteredQueryClose() { @@ -435,9 +437,9 @@ class Builder extends AbstractQuery /** * Set the from parameter (offset). * - * @param integer $value Result number to start from. + * @param int $value Result number to start from. * - * @return \Elastica\Query\Builder + * @return $this */ public function from($value = 0) { @@ -449,7 +451,7 @@ class Builder extends AbstractQuery * * @param float $value Defaults to 0.5. * - * @return \Elastica\Query\Builder + * @return $this */ public function fuzzyMinSim($value = 0.5) { @@ -459,9 +461,9 @@ class Builder extends AbstractQuery /** * Set the prefix length for fuzzy queries. * - * @param integer $value Defaults to 0. + * @param int $value Defaults to 0. * - * @return \Elastica\Query\Builder + * @return $this */ public function fuzzyPrefixLength($value = 0) { @@ -475,7 +477,7 @@ class Builder extends AbstractQuery * * @param mixed $value Value to be gt. * - * @return \Elastica\Query\Builder + * @return $this */ public function gt($value) { @@ -489,7 +491,7 @@ class Builder extends AbstractQuery * * @param mixed $value Value to be gte to. * - * @return \Elastica\Query\Builder + * @return $this */ public function gte($value) { @@ -499,9 +501,9 @@ class Builder extends AbstractQuery /** * Automatically lower-case terms of wildcard, prefix, fuzzy, and range queries. * - * @param boolean $bool Defaults to true. + * @param bool $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function lowercaseExpandedTerms($bool = true) { @@ -515,7 +517,7 @@ class Builder extends AbstractQuery * * @param mixed $value Value to be lt. * - * @return \Elastica\Query\Builder + * @return $this */ public function lt($value) { @@ -529,7 +531,7 @@ class Builder extends AbstractQuery * * @param mixed $value Value to be lte to. * - * @return \Elastica\Query\Builder + * @return $this */ public function lte($value) { @@ -545,13 +547,13 @@ class Builder extends AbstractQuery * * @param float $boost Boost to use. * - * @return \Elastica\Query\Builder + * @return $this */ public function matchAll($boost = null) { $this->fieldOpen('match_all'); - if ( ! $boost == null && is_numeric($boost)) { + if (!$boost == null && is_numeric($boost)) { $this->field('boost', (float) $boost); } @@ -561,9 +563,9 @@ class Builder extends AbstractQuery /** * The minimum number of should clauses to match. * - * @param integer $minimum Minimum number that should match. + * @param int $minimum Minimum number that should match. * - * @return \Elastica\Query\Builder + * @return $this */ public function minimumNumberShouldMatch($minimum) { @@ -573,7 +575,7 @@ class Builder extends AbstractQuery /** * The clause (query) must appear in matching documents. * - * @return \Elastica\Query\Builder + * @return $this */ public function must() { @@ -585,7 +587,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function mustClose() { @@ -598,7 +600,7 @@ class Builder extends AbstractQuery * Note that it is not possible to search on documents that only consists of * a must_not clauses. * - * @return \Elastica\Query\Builder + * @return $this */ public function mustNot() { @@ -610,7 +612,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function mustNotClose() { @@ -620,7 +622,7 @@ class Builder extends AbstractQuery /** * Add an opening brace. * - * @return \Elastica\Query\Builder + * @return $this */ public function open() { @@ -634,9 +636,9 @@ class Builder extends AbstractQuery * * If zero, then exact phrase matches are required. * - * @param integer $value Defaults to 0. + * @param int $value Defaults to 0. * - * @return \Elastica\Query\Builder + * @return $this */ public function phraseSlop($value = 0) { @@ -646,7 +648,7 @@ class Builder extends AbstractQuery /** * Query. * - * @return \Elastica\Query\Builder + * @return $this */ public function prefix() { @@ -658,7 +660,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function prefixClose() { @@ -670,7 +672,7 @@ class Builder extends AbstractQuery * * @param array $queries Array of queries. * - * @return \Elastica\Query\Builder + * @return $this */ public function queries(array $queries) { @@ -688,7 +690,7 @@ class Builder extends AbstractQuery /** * Open a query block. * - * @return \Elastica\Query\Builder + * @return $this */ public function query() { @@ -700,7 +702,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function queryClose() { @@ -712,7 +714,7 @@ class Builder extends AbstractQuery * * A query that uses a query parser in order to parse its content * - * @return \Elastica\Query\Builder + * @return $this */ public function queryString() { @@ -724,7 +726,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function queryStringClose() { @@ -734,7 +736,7 @@ class Builder extends AbstractQuery /** * Open a range block. * - * @return \Elastica\Query\Builder + * @return $this */ public function range() { @@ -746,7 +748,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function rangeClose() { @@ -759,7 +761,7 @@ class Builder extends AbstractQuery * A boolean query with no must clauses, one or more should clauses must * match a document. * - * @return \Elastica\Query\Builder + * @return $this */ public function should() { @@ -771,7 +773,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function shouldClose() { @@ -781,9 +783,9 @@ class Builder extends AbstractQuery /** * Set the size parameter (number of records to return). * - * @param integer $value Number of records to return. + * @param int $value Number of records to return. * - * @return \Elastica\Query\Builder + * @return $this */ public function size($value = 10) { @@ -793,7 +795,7 @@ class Builder extends AbstractQuery /** * Allows to add one or more sort on specific fields. * - * @return \Elastica\Query\Builder + * @return $this */ public function sort() { @@ -805,7 +807,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function sortClose() { @@ -815,10 +817,10 @@ class Builder extends AbstractQuery /** * Add a field to sort on. * - * @param string $name Field to sort. - * @param boolean $reverse Reverse direction. + * @param string $name Field to sort. + * @param bool $reverse Reverse direction. * - * @return \Elastica\Query\Builder + * @return $this */ public function sortField($name, $reverse = false) { @@ -831,12 +833,12 @@ class Builder extends AbstractQuery } /** - * Sort on multiple fields + * Sort on multiple fields. * * @param array $fields Associative array where the keys are field names to sort on, and the * values are the sort order: "asc" or "desc" * - * @return \Elastica\Query\Builder + * @return $this */ public function sortFields(array $fields) { @@ -846,7 +848,7 @@ class Builder extends AbstractQuery $this->_string .= '{"'.$fieldName.'":"'.$order.'"},'; } - $this->_string = rtrim($this->_string, ',') . '],'; + $this->_string = rtrim($this->_string, ',').'],'; return $this; } @@ -858,7 +860,7 @@ class Builder extends AbstractQuery * * The term query maps to Lucene TermQuery. * - * @return \Elastica\Query\Builder + * @return $this */ public function term() { @@ -870,7 +872,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function termClose() { @@ -880,7 +882,7 @@ class Builder extends AbstractQuery /** * Open a 'text_phrase' block. * - * @return \Elastica\Query\Builder + * @return $this */ public function textPhrase() { @@ -890,7 +892,7 @@ class Builder extends AbstractQuery /** * Close a 'text_phrase' block. * - * @return \Elastica\Query\Builder + * @return $this */ public function textPhraseClose() { @@ -902,7 +904,7 @@ class Builder extends AbstractQuery * * @param float $multiplier Multiplier to use. * - * @return \Elastica\Query\Builder + * @return $this */ public function tieBreakerMultiplier($multiplier) { @@ -912,7 +914,7 @@ class Builder extends AbstractQuery /** * Query. * - * @return \Elastica\Query\Builder + * @return $this */ public function wildcard() { @@ -924,7 +926,7 @@ class Builder extends AbstractQuery * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function wildcardClose() { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Common.php b/vendor/ruflin/elastica/lib/Elastica/Query/Common.php index 6e112769..9ca58d2e 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Common.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Common.php @@ -1,12 +1,10 @@ <?php - namespace Elastica\Query; - /** - * Class Common - * @package Elastica - * @link http://www.elasticsearch.org/guide/reference/query-dsl/common-terms-query/ + * Class Common. + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-common-terms-query.html */ class Common extends AbstractQuery { @@ -24,9 +22,9 @@ class Common extends AbstractQuery protected $_queryParams = array(); /** - * @param string $field the field on which to query - * @param string $query the query string - * @param float $cutoffFrequency percentage in decimal form (.001 == 0.1%) + * @param string $field the field on which to query + * @param string $query the query string + * @param float $cutoffFrequency percentage in decimal form (.001 == 0.1%) */ public function __construct($field, $query, $cutoffFrequency) { @@ -36,20 +34,25 @@ class Common extends AbstractQuery } /** - * Set the field on which to query + * Set the field on which to query. + * * @param string $field the field on which to query - * @return \Elastica\Query\Common + * + * @return $this */ public function setField($field) { $this->_field = $field; + return $this; } /** - * Set the query string for this query + * Set the query string for this query. + * * @param string $query - * @return \Elastica\Query\Common + * + * @return $this */ public function setQuery($query) { @@ -57,19 +60,23 @@ class Common extends AbstractQuery } /** - * Set the frequency below which terms will be put in the low frequency group + * Set the frequency below which terms will be put in the low frequency group. + * * @param float $frequency percentage in decimal form (.001 == 0.1%) - * @return \Elastica\Query\Common + * + * @return $this */ public function setCutoffFrequency($frequency) { - return $this->setQueryParam('cutoff_frequency', (float)$frequency); + return $this->setQueryParam('cutoff_frequency', (float) $frequency); } /** - * Set the logic operator for low frequency terms + * Set the logic operator for low frequency terms. + * * @param string $operator see OPERATOR_* class constants for options - * @return \Elastica\Query\Common + * + * @return $this */ public function setLowFrequencyOperator($operator) { @@ -77,9 +84,11 @@ class Common extends AbstractQuery } /** - * Set the logic operator for high frequency terms + * Set the logic operator for high frequency terms. + * * @param string $operator see OPERATOR_* class constants for options - * @return \Elastica\Query\Common + * + * @return $this */ public function setHighFrequencyOperator($operator) { @@ -87,10 +96,13 @@ class Common extends AbstractQuery } /** - * Set the minimum_should_match parameter + * Set the minimum_should_match parameter. + * * @param int|string $minimum minimum number of low frequency terms which must be present - * @return \Elastica\Query\Common - * @link Possible values for minimum_should_match http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html + * + * @return $this + * + * @link Possible values for minimum_should_match http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html */ public function setMinimumShouldMatch($minimum) { @@ -98,19 +110,23 @@ class Common extends AbstractQuery } /** - * Set the boost for this query + * Set the boost for this query. + * * @param float $boost - * @return \Elastica\Query\Common + * + * @return $this */ public function setBoost($boost) { - return $this->setQueryParam('boost', (float)$boost); + return $this->setQueryParam('boost', (float) $boost); } /** - * Set the analyzer for this query + * Set the analyzer for this query. + * * @param string $analyzer - * @return \Elastica\Query\Common + * + * @return $this */ public function setAnalyzer($analyzer) { @@ -118,24 +134,29 @@ class Common extends AbstractQuery } /** - * Enable / disable computation of score factor based on the fraction of all query terms contained in the document + * Enable / disable computation of score factor based on the fraction of all query terms contained in the document. + * * @param bool $disable disable_coord is false by default - * @return \Elastica\Query\Common + * + * @return $this */ public function setDisableCoord($disable = true) { - return $this->setQueryParam('disable_coord', (bool)$disable); + return $this->setQueryParam('disable_coord', (bool) $disable); } /** - * Set a parameter in the body of this query - * @param string $key parameter key - * @param mixed $value parameter value - * @return \Elastica\Query\Common + * Set a parameter in the body of this query. + * + * @param string $key parameter key + * @param mixed $value parameter value + * + * @return $this */ public function setQueryParam($key, $value) { $this->_queryParams[$key] = $value; + return $this; } @@ -145,6 +166,7 @@ class Common extends AbstractQuery public function toArray() { $this->setParam($this->_field, $this->_queryParams); + return parent::toArray(); } -}
\ No newline at end of file +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/ConstantScore.php b/vendor/ruflin/elastica/lib/Elastica/Query/ConstantScore.php index 16854600..3578606d 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/ConstantScore.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/ConstantScore.php @@ -1,20 +1,19 @@ <?php - namespace Elastica\Query; + use Elastica\Filter\AbstractFilter; /** - * Constant score query + * Constant score query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/constant-score-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html */ class ConstantScore extends AbstractQuery { /** - * Construct constant score query + * Construct constant score query. * * @param null|\Elastica\Filter\AbstractFilter|array $filter */ @@ -26,10 +25,11 @@ class ConstantScore extends AbstractQuery } /** - * Set filter + * Set filter. * - * @param array|\Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Query\ConstantScore Query object + * @param array|\Elastica\Filter\AbstractFilter $filter + * + * @return $this */ public function setFilter($filter) { @@ -41,10 +41,11 @@ class ConstantScore extends AbstractQuery } /** - * Set query + * Set query. * * @param array|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\ConstantScore Query object + * + * @return $this */ public function setQuery($query) { @@ -56,10 +57,11 @@ class ConstantScore extends AbstractQuery } /** - * Set boost + * Set boost. + * + * @param float $boost * - * @param float $boost - * @return \Elastica\Query\ConstantScore + * @return $this */ public function setBoost($boost) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/DisMax.php b/vendor/ruflin/elastica/lib/Elastica/Query/DisMax.php index 4b1d320d..b3c5f252 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/DisMax.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/DisMax.php @@ -1,24 +1,25 @@ <?php - namespace Elastica\Query; + use Elastica\Exception\InvalidException; /** - * DisMax query + * DisMax query. * - * @category Xodoa - * @package Elastica * @author Hung Tran <oohnoitz@gmail.com> - * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-dis-max-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-dis-max-query.html */ class DisMax extends AbstractQuery { /** - * Adds a query to the current object + * Adds a query to the current object. + * + * @param \Elastica\Query\AbstractQuery|array $args Query * - * @param \Elastica\Query\AbstractQuery|array $args Query - * @return \Elastica\Query\DisMax * @throws \Elastica\Exception\InvalidException If not valid query + * + * @return $this */ public function addQuery($args) { @@ -34,10 +35,11 @@ class DisMax extends AbstractQuery } /** - * Set boost + * Set boost. + * + * @param float $boost * - * @param float $boost - * @return \Elastica\Query\DisMax + * @return $this */ public function setBoost($boost) { @@ -49,8 +51,9 @@ class DisMax extends AbstractQuery * * If not set, defaults to 0.0 * - * @param float $tieBreaker - * @return \Elastica\Query\DisMax + * @param float $tieBreaker + * + * @return $this */ public function setTieBreaker($tieBreaker = 0.0) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php b/vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php index c28d4cdd..ac085037 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Filtered.php @@ -1,36 +1,36 @@ <?php - namespace Elastica\Query; -use Elastica\Filter\AbstractFilter; use Elastica\Exception\InvalidException; +use Elastica\Filter\AbstractFilter; /** - * Filtered query. Needs a query and a filter + * 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 + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html */ class Filtered extends AbstractQuery { /** - * Constructs a filtered query + * 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) { + public function __construct(AbstractQuery $query = null, AbstractFilter $filter = null) + { $this->setQuery($query); $this->setFilter($filter); } /** - * Sets a query + * Sets a query. * - * @param \Elastica\Query\AbstractQuery $query Query object - * @return \Elastica\Query\Filtered Current object + * @param \Elastica\Query\AbstractQuery $query Query object + * + * @return $this */ public function setQuery(AbstractQuery $query = null) { @@ -38,10 +38,11 @@ class Filtered extends AbstractQuery } /** - * Sets the filter + * Sets the filter. + * + * @param \Elastica\Filter\AbstractFilter $filter Filter object * - * @param \Elastica\Filter\AbstractFilter $filter Filter object - * @return \Elastica\Query\Filtered Current object + * @return $this */ public function setFilter(AbstractFilter $filter = null) { @@ -69,9 +70,10 @@ class Filtered extends AbstractQuery } /** - * Converts query to array + * Converts query to array. * * @return array Query array + * * @see \Elastica\Query\AbstractQuery::toArray() */ public function toArray() @@ -89,7 +91,7 @@ class Filtered extends AbstractQuery if (empty($filtered)) { throw new InvalidException('A query and/or filter is required'); } - + return array('filtered' => $filtered); } } diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/FunctionScore.php b/vendor/ruflin/elastica/lib/Elastica/Query/FunctionScore.php index 8230c86e..b11454fb 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/FunctionScore.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/FunctionScore.php @@ -1,13 +1,13 @@ <?php - namespace Elastica\Query; + use Elastica\Filter\AbstractFilter; use Elastica\Script; /** - * Class FunctionScore - * @package Elastica\Query - * @link http://www.elasticsearch.org/guide/reference/query-dsl/function-score-query/ + * Class FunctionScore. + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html */ class FunctionScore extends AbstractQuery { @@ -32,9 +32,11 @@ class FunctionScore extends AbstractQuery protected $_functions = array(); /** - * Set the child query for this function_score query + * Set the child query for this function_score query. + * * @param AbstractQuery $query - * @return \Elastica\Query\FunctionScore + * + * @return $this */ public function setQuery(AbstractQuery $query) { @@ -43,7 +45,8 @@ class FunctionScore extends AbstractQuery /** * @param AbstractFilter $filter - * @return \Elastica\Param + * + * @return $this */ public function setFilter(AbstractFilter $filter) { @@ -51,113 +54,151 @@ class FunctionScore extends AbstractQuery } /** - * Add a function to the function_score query - * @param string $functionType valid values are DECAY_* constants and script_score - * @param array|float $functionParams the body of the function. See documentation for proper syntax. - * @param AbstractFilter $filter optional filter to apply to the function - * @return \Elastica\Query\FunctionScore + * Add a function to the function_score query. + * + * @param string $functionType valid values are DECAY_* constants and script_score + * @param array|float $functionParams the body of the function. See documentation for proper syntax. + * @param AbstractFilter $filter optional filter to apply to the function + * @param float $weight function weight + * + * @return $this */ - public function addFunction($functionType, $functionParams, AbstractFilter $filter = NULL) + public function addFunction($functionType, $functionParams, AbstractFilter $filter = null, $weight = null) { $function = array( - $functionType => $functionParams + $functionType => $functionParams, ); if (!is_null($filter)) { $function['filter'] = $filter->toArray(); } + if ($weight !== null) { + $function['weight'] = $weight; + } + $this->_functions[] = $function; + return $this; } /** - * Add a script_score function to the query - * @param Script $script a Script object + * Add a script_score function to the query. + * + * @param Script $script a Script object * @param AbstractFilter $filter an optional filter to apply to the function - * @return \Elastica\Query\FunctionScore + * @param float $weight the weight of the function + * + * @return $this */ - public function addScriptScoreFunction(Script $script, AbstractFilter $filter = NULL) + public function addScriptScoreFunction(Script $script, AbstractFilter $filter = null, $weight = null) { - return $this->addFunction('script_score', $script->toArray(), $filter); + return $this->addFunction('script_score', $script->toArray(), $filter, $weight); } /** - * Add a decay function to the query - * @param string $function see DECAY_* constants for valid options - * @param string $field the document field on which to perform the decay function - * @param string $origin the origin value for this decay function - * @param string $scale a scale to define the rate of decay for this function - * @param string $offset If defined, this function will only be computed for documents with a distance from the origin greater than this value - * @param float $decay optionally defines how documents are scored at the distance given by the $scale parameter - * @param float $scaleWeight optional factor by which to multiply the score at the value provided by the $scale parameter - * @param AbstractFilter $filter a filter associated with this function - * @return \Elastica\Query\FunctionScore + * Add a decay function to the query. + * + * @param string $function see DECAY_* constants for valid options + * @param string $field the document field on which to perform the decay function + * @param string $origin the origin value for this decay function + * @param string $scale a scale to define the rate of decay for this function + * @param string $offset If defined, this function will only be computed for documents with a distance from the origin greater than this value + * @param float $decay optionally defines how documents are scored at the distance given by the $scale parameter + * @param float $scaleWeight optional factor by which to multiply the score at the value provided by the $scale parameter + * @param float $weight optional factor by which to multiply the score at the value provided by the $scale parameter + * @param AbstractFilter $filter a filter associated with this function + * + * @return $this */ - public function addDecayFunction($function, $field, $origin, $scale, $offset = NULL, $decay = NULL, $scaleWeight = NULL, - AbstractFilter $filter = NULL) - { + public function addDecayFunction( + $function, + $field, + $origin, + $scale, + $offset = null, + $decay = null, + $weight = null, + AbstractFilter $filter = null + ) { $functionParams = array( $field => array( 'origin' => $origin, - 'scale' => $scale - ) + 'scale' => $scale, + ), ); if (!is_null($offset)) { $functionParams[$field]['offset'] = $offset; } if (!is_null($decay)) { - $functionParams[$field]['decay'] = (float)$decay; - } - if (!is_null($scaleWeight)) { - $functionParams[$field]['scale_weight'] = (float)$scaleWeight; + $functionParams[$field]['decay'] = (float) $decay; } - return $this->addFunction($function, $functionParams, $filter); + + return $this->addFunction($function, $functionParams, $filter, $weight); } /** - * Add a boost_factor function to the query - * @param float $boostFactor the boost factor value + * Add a boost_factor function to the query. + * + * @param float $boostFactor the boost factor value + * @param AbstractFilter $filter a filter associated with this function + * + * @deprecated + */ + public function addBoostFactorFunction($boostFactor, AbstractFilter $filter = null) + { + $this->addWeightFunction($boostFactor, $filter); + } + + /** + * @param float $weight the weight of the function * @param AbstractFilter $filter a filter associated with this function */ - public function addBoostFactorFunction($boostFactor, AbstractFilter $filter = NULL) + public function addWeightFunction($weight, AbstractFilter $filter = null) { - $this->addFunction('boost_factor', $boostFactor, $filter); + $this->addFunction('weight', $weight, $filter); } /** - * Add a random_score function to the query - * @param number $seed the seed value + * Add a random_score function to the query. + * + * @param number $seed the seed value * @param AbstractFilter $filter a filter associated with this function - * @param float $boost an optional boost value associated with this function + * @param float $weight an optional boost value associated with this function */ - public function addRandomScoreFunction($seed, AbstractFilter $filter = NULL, $boost = NULL) + public function addRandomScoreFunction($seed, AbstractFilter $filter = null, $weight = null) { - $this->addFunction('random_score', array('seed' => $seed), $filter, $boost); + $this->addFunction('random_score', array('seed' => $seed), $filter, $weight); } /** - * Set an overall boost value for this query + * Set an overall boost value for this query. + * * @param float $boost - * @return \Elastica\Query\FunctionScore + * + * @return $this */ public function setBoost($boost) { - return $this->setParam('boost', (float)$boost); + return $this->setParam('boost', (float) $boost); } /** - * Restrict the combined boost of the function_score query and its child query + * Restrict the combined boost of the function_score query and its child query. + * * @param float $maxBoost - * @return \Elastica\Query\FunctionScore + * + * @return $this */ public function setMaxBoost($maxBoost) { - return $this->setParam('max_boost', (float)$maxBoost); + return $this->setParam('max_boost', (float) $maxBoost); } /** - * The boost mode determines how the score of this query is combined with that of the child query + * The boost mode determines how the score of this query is combined with that of the child query. + * * @param string $mode see BOOST_MODE_* constants for valid options. Default is multiply. - * @return \Elastica\Query\FunctionScore + * + * @return $this */ public function setBoostMode($mode) { @@ -166,22 +207,27 @@ class FunctionScore extends AbstractQuery /** * If set, this query will return results in random order. + * * @param int $seed Set a seed value to return results in the same random order for consistent pagination. - * @return \Elastica\Query\FunctionScore + * + * @return $this */ - public function setRandomScore($seed = NULL) + public function setRandomScore($seed = null) { $seedParam = new \stdClass(); if (!is_null($seed)) { $seedParam->seed = $seed; } + return $this->setParam('random_score', $seedParam); } /** - * Set the score method + * Set the score method. + * * @param string $mode see SCORE_MODE_* constants for valid options. Default is multiply. - * @return \Elastica\Query\FunctionScore + * + * @return $this */ public function setScoreMode($mode) { @@ -189,6 +235,18 @@ class FunctionScore extends AbstractQuery } /** + * Set min_score option. + * + * @param float $minScore + * + * @return $this + */ + public function setMinScore($minScore) + { + return $this->setParam('min_score', (float) $minScore); + } + + /** * @return array */ public function toArray() @@ -196,6 +254,7 @@ class FunctionScore extends AbstractQuery if (sizeof($this->_functions)) { $this->setParam('functions', $this->_functions); } + return parent::toArray(); } -}
\ No newline at end of file +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Fuzzy.php b/vendor/ruflin/elastica/lib/Elastica/Query/Fuzzy.php index 73b0f1a1..a3a46693 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Fuzzy.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Fuzzy.php @@ -1,27 +1,24 @@ <?php - namespace Elastica\Query; use Elastica\Exception\InvalidException; /** - * Fuzzy query + * Fuzzy query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/fuzzy-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html */ class Fuzzy extends AbstractQuery { /** - * Construct a fuzzy query + * Construct a fuzzy query. * - * @param string $fieldName Field name - * @param string $value String to search for - * @return \Elastica\Query\Fuzzy Current object + * @param string $fieldName Field name + * @param string $value String to search for */ - public function __construct ($fieldName = null, $value = null) + public function __construct($fieldName = null, $value = null) { if ($fieldName and $value) { $this->setField($fieldName, $value); @@ -29,13 +26,14 @@ class Fuzzy extends AbstractQuery } /** - * Set field for fuzzy query + * Set field for fuzzy query. * - * @param string $fieldName Field name - * @param string $value String to search for - * @return \Elastica\Query\Fuzzy Current object + * @param string $fieldName Field name + * @param string $value String to search for + * + * @return $this */ - public function setField ($fieldName, $value) + public function setField($fieldName, $value) { if (!is_string($value) or !is_string($fieldName)) { throw new InvalidException('The field and value arguments must be of type string.'); @@ -43,30 +41,34 @@ class Fuzzy extends AbstractQuery if (count($this->getParams()) > 0 and array_shift(array_keys($this->getParams())) != $fieldName) { throw new InvalidException('Fuzzy query can only support a single field.'); } + return $this->setParam($fieldName, array('value' => $value)); } /** - * Set optional parameters on the existing query + * Set optional parameters on the existing query. * - * @param string $param option name - * @param mixed $value Value of the parameter - * @return \Elastica\Query\Fuzzy Current object + * @param string $param option name + * @param mixed $value Value of the parameter + * + * @return $this */ - public function setFieldOption ($param, $value) { + public function setFieldOption($param, $value) + { //Retrieve the single existing field for alteration. $params = $this->getParams(); if (count($params) < 1) { - throw new InvalidException('No field has been set'); + throw new InvalidException('No field has been set'); } $keyArray = array_keys($params); $params[$keyArray[0]][$param] = $value; - return $this->setparam($keyArray[0], $params[$keyArray[0]]); + return $this->setParam($keyArray[0], $params[$keyArray[0]]); } /** * Deprecated method of setting a field. + * * @deprecated */ public function addField($fieldName, $args) @@ -79,6 +81,7 @@ class Fuzzy extends AbstractQuery foreach ($args as $param => $value) { $this->setFieldOption($param, $value); } + return $this; } } diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php b/vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php index ffa34a81..2de480a8 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php @@ -1,79 +1,77 @@ <?php - namespace Elastica\Query; /** - * Fuzzy Like This query + * Fuzzy Like This query. * - * @category Xodoa - * @package Elastica * @author Raul Martinez, Jr <juneym@gmail.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/flt-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-flt-query.html */ class FuzzyLikeThis extends AbstractQuery { /** - * Field names + * Field names. * * @var array Field names */ protected $_fields = array(); /** - * Like text + * Like text. * * @var string Like text */ - protected $_likeText = ''; + protected $_likeText = ''; /** - * Ignore term frequency + * Ignore term frequency. * - * @var boolean ignore term frequency + * @var bool ignore term frequency */ protected $_ignoreTF = false; /** - * Max query terms value + * Max query terms value. * * @var int Max query terms value */ protected $_maxQueryTerms = 25; /** - * minimum similarity + * minimum similarity. * * @var int minimum similarity */ protected $_minSimilarity = 0.5; /** - * Prefix Length + * Prefix Length. * * @var int Prefix Length */ protected $_prefixLength = 0; /** - * Boost + * Boost. * * @var float Boost */ protected $_boost = 1.0; /** - * Analyzer + * Analyzer. * * @var sting Analyzer */ protected $_analyzer; - /** - * Adds field to flt query + * Adds field to flt query. + * + * @param array $fields Field names * - * @param array $fields Field names - * @return \Elastica\Query\FuzzyLikeThis Current object + * @return $this */ public function addFields(array $fields) { @@ -83,10 +81,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set the "like_text" value + * Set the "like_text" value. * - * @param string $text - * @return \Elastica\Query\FuzzyLikeThis This current object + * @param string $text + * + * @return $this */ public function setLikeText($text) { @@ -97,10 +96,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set the "ignore_tf" value (ignore term frequency) + * Set the "ignore_tf" value (ignore term frequency). + * + * @param bool $ignoreTF * - * @param bool $ignoreTF - * @return \Elastica\Query\FuzzyLikeThis Current object + * @return $this */ public function setIgnoreTF($ignoreTF) { @@ -110,10 +110,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set the minimum similarity + * Set the minimum similarity. * - * @param int $value - * @return \Elastica\Query\FuzzyLikeThis This current object + * @param int $value + * + * @return $this */ public function setMinSimilarity($value) { @@ -124,10 +125,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set boost + * Set boost. + * + * @param float $value Boost value * - * @param float $value Boost value - * @return \Elastica\Query\FuzzyLikeThis Query object + * @return $this */ public function setBoost($value) { @@ -137,10 +139,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set Prefix Length + * Set Prefix Length. * - * @param int $value Prefix length - * @return \Elastica\Query\FuzzyLikeThis + * @param int $value Prefix length + * + * @return $this */ public function setPrefixLength($value) { @@ -150,10 +153,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set max_query_terms + * Set max_query_terms. + * + * @param int $value Max query terms value * - * @param int $value Max query terms value - * @return \Elastica\Query\FuzzyLikeThis + * @return $this */ public function setMaxQueryTerms($value) { @@ -163,10 +167,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set analyzer + * Set analyzer. * - * @param string $text Analyzer text - * @return \Elastica\Query\FuzzyLikeThis + * @param string $text Analyzer text + * + * @return $this */ public function setAnalyzer($text) { @@ -177,9 +182,10 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Converts fuzzy like this query to array + * Converts fuzzy like this query to array. * * @return array Query array + * * @see \Elastica\Query\AbstractQuery::toArray() */ public function toArray() @@ -192,18 +198,14 @@ class FuzzyLikeThis extends AbstractQuery $args['boost'] = $this->_boost; } - if (!empty($this->_likeText)) { - $args['like_text'] = $this->_likeText; - } - if (!empty($this->_analyzer)) { $args['analyzer'] = $this->_analyzer; } - $args['min_similarity'] = ($this->_minSimilarity > 0) ? $this->_minSimilarity : 0; - $args['prefix_length'] = $this->_prefixLength; + $args['like_text'] = $this->_likeText; + $args['prefix_length'] = $this->_prefixLength; $args['ignore_tf'] = $this->_ignoreTF; $args['max_query_terms'] = $this->_maxQueryTerms; diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/HasChild.php b/vendor/ruflin/elastica/lib/Elastica/Query/HasChild.php index e849a9bf..190fa592 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/HasChild.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/HasChild.php @@ -1,23 +1,22 @@ <?php - namespace Elastica\Query; + use Elastica\Query as BaseQuery; /** - * 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-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-query.html */ class HasChild extends AbstractQuery { /** - * Construct HasChild Query + * Construct HasChild Query. * * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @param string $type Parent document type + * @param string $type Parent document type */ public function __construct($query, $type = null) { @@ -26,10 +25,11 @@ class HasChild extends AbstractQuery } /** - * Sets query object + * Sets query object. * - * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\HasChild + * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query + * + * @return $this */ public function setQuery($query) { @@ -40,10 +40,11 @@ class HasChild extends AbstractQuery } /** - * Set type of the parent document + * Set type of the parent document. + * + * @param string $type Parent document type * - * @param string $type Parent document type - * @return \Elastica\Query\HasChild Current object + * @return $this */ public function setType($type) { @@ -51,10 +52,11 @@ class HasChild extends AbstractQuery } /** - * Sets the scope + * Sets the scope. + * + * @param string $scope Scope * - * @param string $scope Scope - * @return \Elastica\Query\HasChild Current object + * @return $this */ public function setScope($scope) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/HasParent.php b/vendor/ruflin/elastica/lib/Elastica/Query/HasParent.php index 809fb18d..03aae13b 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/HasParent.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/HasParent.php @@ -1,22 +1,20 @@ <?php - namespace Elastica\Query; + use Elastica\Query as BaseQuery; /** - * 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-query.html + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-parent-query.html */ class HasParent extends AbstractQuery { /** - * Construct HasChild Query + * Construct HasChild Query. * - * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @param string $type Parent document type + * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query + * @param string $type Parent document type */ public function __construct($query, $type) { @@ -25,10 +23,11 @@ class HasParent extends AbstractQuery } /** - * 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 + * @return $this */ public function setQuery($query) { @@ -39,10 +38,11 @@ class HasParent extends AbstractQuery } /** - * 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 $type Parent document type + * + * @return $this */ public function setType($type) { @@ -50,10 +50,11 @@ class HasParent extends AbstractQuery } /** - * Sets the scope + * Sets the scope. + * + * @param string $scope Scope * - * @param string $scope Scope - * @return \Elastica\Filter\HasParent Current object + * @return $this */ public function setScope($scope) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Ids.php b/vendor/ruflin/elastica/lib/Elastica/Query/Ids.php index f4a6f1aa..5d76efcf 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Ids.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Ids.php @@ -1,32 +1,31 @@ <?php - namespace Elastica\Query; + use Elastica\Type; /** - * Ids Query + * Ids Query. * - * @category Xodoa - * @package Elastica * @author Lee Parker * @author Nicolas Ruflin <spam@ruflin.com> * @author Tim Rupp - * @link http://www.elasticsearch.org/guide/reference/query-dsl/ids-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-ids-query.html */ class Ids extends AbstractQuery { /** - * Params + * Params. * * @var array Params */ protected $_params = array(); /** - * 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()) { @@ -35,10 +34,11 @@ class Ids extends AbstractQuery } /** - * 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\Query\Ids Current object + * @return $this */ public function addId($id) { @@ -48,10 +48,11 @@ class Ids extends AbstractQuery } /** - * Adds one more type to query + * Adds one more type to query. * - * @param string|\Elastica\Type $type Type name or object - * @return \Elastica\Query\Ids Current object + * @param string|\Elastica\Type $type Type name or object + * + * @return $this */ public function addType($type) { @@ -68,10 +69,11 @@ class Ids extends AbstractQuery } /** - * Set type + * Set type. + * + * @param string|\Elastica\Type $type Type name or object * - * @param string|\Elastica\Type $type Type name or object - * @return \Elastica\Query\Ids Current object + * @return $this */ public function setType($type) { @@ -88,10 +90,11 @@ class Ids extends AbstractQuery } /** - * Sets the ids to filter + * Sets the ids to filter. * - * @param array|string $ids List of ids - * @return \Elastica\Query\Ids Current object + * @param array|string $ids List of ids + * + * @return $this */ public function setIds($ids) { @@ -105,9 +108,10 @@ class Ids extends AbstractQuery } /** - * Converts filter to array + * Converts filter to array. * * @see \Elastica\Query\AbstractQuery::toArray() + * * @return array Query array */ public function toArray() diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Image.php b/vendor/ruflin/elastica/lib/Elastica/Query/Image.php new file mode 100644 index 00000000..bf7d028b --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Image.php @@ -0,0 +1,187 @@ +<?php +namespace Elastica\Query; + +/** + * Image query. + * + * @author Jacques Moati <jacques@moati.net> + * + * @link https://github.com/kzwang/elasticsearch-image + * + * To use this feature you have to call the following command in the + * elasticsearch directory: + * <code> + * ./bin/plugin --url https://github.com/SibaTokyo/elasticsearch-image/releases/download/1.4.0/elasticsearch-image-1.4.0.zip --install image + * </code> + * This installs the image plugin. More infos + * can be found here: {@link https://github.com/SibaTokyo/elasticsearch-image} + */ +class Image extends AbstractQuery +{ + public function __construct(array $image = array()) + { + $this->setParams($image); + } + + /** + * Sets a param for the given field. + * + * @param string $field + * @param string $key + * @param string $value + * + * @return $this + */ + public function setFieldParam($field, $key, $value) + { + if (!isset($this->_params[$field])) { + $this->_params[$field] = array(); + } + + $this->_params[$field][$key] = $value; + + return $this; + } + + /** + * Set field boost value. + * + * If not set, defaults to 1.0. + * + * @param string $field + * @param float $boost + * + * @return $this + */ + public function setFieldBoost($field, $boost = 1.0) + { + return $this->setFieldParam($field, 'boost', (float) $boost); + } + + /** + * Set field feature value. + * + * If not set, defaults CEDD. + * + * @param string $field + * @param string $feature + * + * @return $this + */ + public function setFieldFeature($field, $feature = 'CEDD') + { + return $this->setFieldParam($field, 'feature', $feature); + } + + /** + * Set field hash value. + * + * If not set, defaults BIT_SAMPLING. + * + * @param string $field + * @param string $hash + * + * @return $this + */ + public function setFieldHash($field, $hash = 'BIT_SAMPLING') + { + return $this->setFieldParam($field, 'hash', $hash); + } + + /** + * Set field image value. + * + * @param string $field + * @param string $path File will be base64_encode + * + * @throws \Exception + * + * @return $this + */ + public function setFieldImage($field, $path) + { + if (!file_exists($path) || !is_readable($path)) { + throw new \Exception(sprintf("File %s can't be open", $path)); + } + + return $this->setFieldParam($field, 'image', base64_encode(file_get_contents($path))); + } + + /** + * Set field index value. + * + * @param string $field + * @param string $index + * + * @return $this + */ + public function setFieldIndex($field, $index) + { + return $this->setFieldParam($field, 'index', $index); + } + + /** + * Set field type value. + * + * @param string $field + * @param string $type + * + * @return $this + */ + public function setFieldType($field, $type) + { + return $this->setFieldParam($field, 'type', $type); + } + + /** + * Set field id value. + * + * @param string $field + * @param string $id + * + * @return $this + */ + public function setFieldId($field, $id) + { + return $this->setFieldParam($field, 'id', $id); + } + + /** + * Set field path value. + * + * @param string $field + * @param string $path + * + * @return $this + */ + public function setFieldPath($field, $path) + { + return $this->setFieldParam($field, 'path', $path); + } + + /** + * Define quickly a reference image already in your elasticsearch database. + * + * If not set, path will be the same as $field. + * + * @param string $field + * @param string $index + * @param string $type + * @param string $id + * @param string $path + * + * @return $this + */ + public function setImageByReference($field, $index, $type, $id, $path = null) + { + if (null === $path) { + $path = $field; + } + + $this->setFieldIndex($field, $index); + $this->setFieldType($field, $type); + $this->setFieldId($field, $id); + + return $this->setFieldPath($field, $path); + } +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Match.php b/vendor/ruflin/elastica/lib/Elastica/Query/Match.php index ba66ad63..abb40970 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Match.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Match.php @@ -1,27 +1,37 @@ <?php - namespace Elastica\Query; /** - * Match query + * Match query. * - * @category Xodoa - * @package Elastica * @author F21 * @author WONG Wing Lun <luiges90@gmail.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/match-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html */ class Match extends AbstractQuery { - const ZERO_TERM_NONE = 'none'; - const ZERO_TERM_ALL = 'all'; + const ZERO_TERM_NONE = 'none'; + const ZERO_TERM_ALL = 'all'; + + /** + * @param string $field + * @param mixed $values + */ + public function __construct($field = null, $values = null) + { + if ($field !== null && $values !== null) { + $this->setParam($field, $values); + } + } /** - * Sets a param for the message array + * Sets a param for the message array. + * + * @param string $field + * @param mixed $values * - * @param string $field - * @param mixed $values - * @return \Elastica\Query\Match + * @return $this */ public function setField($field, $values) { @@ -29,12 +39,13 @@ class Match extends AbstractQuery } /** - * Sets a param for the given field + * Sets a param for the given field. * - * @param string $field - * @param string $key - * @param string $value - * @return \Elastica\Query\Match + * @param string $field + * @param string $key + * @param string $value + * + * @return $this */ public function setFieldParam($field, $key, $value) { @@ -48,11 +59,12 @@ class Match extends AbstractQuery } /** - * Sets the query string + * Sets the query string. + * + * @param string $field + * @param string $query * - * @param string $field - * @param string $query - * @return \Elastica\Query\Match + * @return $this */ public function setFieldQuery($field, $query) { @@ -60,11 +72,12 @@ class Match extends AbstractQuery } /** - * Set field type + * Set field type. + * + * @param string $field + * @param string $type * - * @param string $field - * @param string $type - * @return \Elastica\Query\Match + * @return $this */ public function setFieldType($field, $type) { @@ -72,11 +85,12 @@ class Match extends AbstractQuery } /** - * Set field operator + * Set field operator. * - * @param string $field - * @param string $operator - * @return \Elastica\Query\Match + * @param string $field + * @param string $operator + * + * @return $this */ public function setFieldOperator($field, $operator) { @@ -84,11 +98,12 @@ class Match extends AbstractQuery } /** - * Set field analyzer + * Set field analyzer. + * + * @param string $field + * @param string $analyzer * - * @param string $field - * @param string $analyzer - * @return \Elastica\Query\Match + * @return $this */ public function setFieldAnalyzer($field, $analyzer) { @@ -96,13 +111,14 @@ class Match extends AbstractQuery } /** - * Set field boost value + * Set field boost value. * * If not set, defaults to 1.0. * - * @param string $field - * @param float $boost - * @return \Elastica\Query\Match + * @param string $field + * @param float $boost + * + * @return $this */ public function setFieldBoost($field, $boost = 1.0) { @@ -110,12 +126,14 @@ class Match extends AbstractQuery } /** - * Set field minimum should match + * Set field minimum should match. * - * @param string $field - * @param int|string $minimumShouldMatch - * @return \Elastica\Query\Match - * @link Possible values for minimum_should_match http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html + * @param string $field + * @param int|string $minimumShouldMatch + * + * @return $this + * + * @link Possible values for minimum_should_match http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html */ public function setFieldMinimumShouldMatch($field, $minimumShouldMatch) { @@ -123,11 +141,12 @@ class Match extends AbstractQuery } /** - * Set field fuzziness + * Set field fuzziness. + * + * @param string $field + * @param mixed $fuzziness * - * @param string $field - * @param mixed $fuzziness - * @return \Elastica\Query\Match + * @return $this */ public function setFieldFuzziness($field, $fuzziness) { @@ -135,11 +154,12 @@ class Match extends AbstractQuery } /** - * Set field fuzzy rewrite + * Set field fuzzy rewrite. * - * @param string $field - * @param string $fuzzyRewrite - * @return \Elastica\Query\Match + * @param string $field + * @param string $fuzzyRewrite + * + * @return $this */ public function setFieldFuzzyRewrite($field, $fuzzyRewrite) { @@ -147,11 +167,12 @@ class Match extends AbstractQuery } /** - * Set field prefix length + * Set field prefix length. + * + * @param string $field + * @param int $prefixLength * - * @param string $field - * @param int $prefixLength - * @return \Elastica\Query\Match + * @return $this */ public function setFieldPrefixLength($field, $prefixLength) { @@ -159,11 +180,12 @@ class Match extends AbstractQuery } /** - * Set field max expansions + * Set field max expansions. + * + * @param string $field + * @param int $maxExpansions * - * @param string $field - * @param int $maxExpansions - * @return \Elastica\Query\Match + * @return $this */ public function setFieldMaxExpansions($field, $maxExpansions) { @@ -171,13 +193,14 @@ class Match extends AbstractQuery } /** - * Set zero terms query + * Set zero terms query. * * If not set, default to 'none' * - * @param string $field - * @param string $zeroTermQuery - * @return \Elastica\Query\Match + * @param string $field + * @param string $zeroTermQuery + * + * @return $this */ public function setFieldZeroTermsQuery($field, $zeroTermQuery = 'none') { @@ -185,11 +208,12 @@ class Match extends AbstractQuery } /** - * Set cutoff frequency + * Set cutoff frequency. + * + * @param string $field + * @param float $cutoffFrequency * - * @param string $field - * @param float $cutoffFrequency - * @return \Elastica\Query\Match + * @return $this */ public function setFieldCutoffFrequency($field, $cutoffFrequency) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/MatchAll.php b/vendor/ruflin/elastica/lib/Elastica/Query/MatchAll.php index 23b4fdfc..d01aaee8 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/MatchAll.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/MatchAll.php @@ -1,19 +1,17 @@ <?php - namespace Elastica\Query; /** - * Match all query. Returns all results + * Match all query. Returns all results. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/match-all-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html */ class MatchAll extends AbstractQuery { /** - * Creates match all query + * Creates match all query. */ public function __construct() { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/MatchPhrase.php b/vendor/ruflin/elastica/lib/Elastica/Query/MatchPhrase.php new file mode 100644 index 00000000..54302f90 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Query/MatchPhrase.php @@ -0,0 +1,13 @@ +<?php +namespace Elastica\Query; + +/** + * Match Phrase query. + * + * @author Jacques Moati <jacques@moati.net> + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase + */ +class MatchPhrase extends Match +{ +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/MatchPhrasePrefix.php b/vendor/ruflin/elastica/lib/Elastica/Query/MatchPhrasePrefix.php new file mode 100644 index 00000000..61764bda --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Query/MatchPhrasePrefix.php @@ -0,0 +1,13 @@ +<?php +namespace Elastica\Query; + +/** + * Match Phrase Prefix query. + * + * @author Jacques Moati <jacques@moati.net> + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_match_phrase_prefix + */ +class MatchPhrasePrefix extends Match +{ +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/MoreLikeThis.php b/vendor/ruflin/elastica/lib/Elastica/Query/MoreLikeThis.php index d9ae4284..cd375db5 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/MoreLikeThis.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/MoreLikeThis.php @@ -1,21 +1,20 @@ <?php - namespace Elastica\Query; /** - * More Like This query + * More Like This query. * - * @category Xodoa - * @package Elastica * @author Raul Martinez, Jr <juneym@gmail.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-mlt-query.html */ class MoreLikeThis extends AbstractQuery { /** - * Adds field to mlt query + * Set fields to which to restrict the mlt query. + * + * @param array $fields Field names * - * @param array $fields Field names * @return \Elastica\Query\MoreLikeThis Current object */ public function setFields(array $fields) @@ -24,10 +23,23 @@ class MoreLikeThis extends AbstractQuery } /** - * Set the "like_text" value + * Set document ids for the mlt query. + * + * @param array $ids Document ids + * + * @return \Elastica\Query\MoreLikeThis Current object + */ + public function setIds(array $ids) + { + return $this->setParam('ids', $ids); + } + + /** + * Set the "like_text" value. + * + * @param string $likeText * - * @param string $likeText - * @return \Elastica\Query\MoreLikeThis This current object + * @return $this */ public function setLikeText($likeText) { @@ -37,10 +49,11 @@ class MoreLikeThis extends AbstractQuery } /** - * Set boost + * Set boost. * - * @param float $boost Boost value - * @return \Elastica\Query\MoreLikeThis Query object + * @param float $boost Boost value + * + * @return $this */ public function setBoost($boost) { @@ -48,10 +61,11 @@ class MoreLikeThis extends AbstractQuery } /** - * Set max_query_terms + * Set max_query_terms. + * + * @param int $maxQueryTerms Max query terms value * - * @param int $maxQueryTerms Max query terms value - * @return \Elastica\Query\MoreLikeThis + * @return $this */ public function setMaxQueryTerms($maxQueryTerms) { @@ -59,10 +73,13 @@ class MoreLikeThis extends AbstractQuery } /** - * Set percent terms to match + * Set percent terms to match. + * + * @param float $percentTermsToMatch Percentage + * + * @return $this * - * @param float $percentTermsToMatch Percentage - * @return \Elastica\Query\MoreLikeThis + * @deprecated Option "percent_terms_to_match" deprecated as of ES 1.5. Use "minimum_should_match" instead. */ public function setPercentTermsToMatch($percentTermsToMatch) { @@ -70,10 +87,11 @@ class MoreLikeThis extends AbstractQuery } /** - * Set min term frequency + * Set min term frequency. * - * @param int $minTermFreq - * @return \Elastica\Query\MoreLikeThis + * @param int $minTermFreq + * + * @return $this */ public function setMinTermFrequency($minTermFreq) { @@ -81,10 +99,11 @@ class MoreLikeThis extends AbstractQuery } /** - * set min document frequency + * set min document frequency. + * + * @param int $minDocFreq * - * @param int $minDocFreq - * @return \Elastica\Query\MoreLikeThis + * @return $this */ public function setMinDocFrequency($minDocFreq) { @@ -92,10 +111,11 @@ class MoreLikeThis extends AbstractQuery } /** - * set max document frequency + * set max document frequency. * - * @param int $maxDocFreq - * @return \Elastica\Query\MoreLikeThis + * @param int $maxDocFreq + * + * @return $this */ public function setMaxDocFrequency($maxDocFreq) { @@ -103,10 +123,11 @@ class MoreLikeThis extends AbstractQuery } /** - * Set min word length + * Set min word length. + * + * @param int $minWordLength * - * @param int $minWordLength - * @return \Elastica\Query\MoreLikeThis + * @return $this */ public function setMinWordLength($minWordLength) { @@ -114,10 +135,11 @@ class MoreLikeThis extends AbstractQuery } /** - * Set max word length + * Set max word length. * - * @param int $maxWordLength - * @return \Elastica\Query\MoreLikeThis + * @param int $maxWordLength + * + * @return $this */ public function setMaxWordLength($maxWordLength) { @@ -125,11 +147,11 @@ class MoreLikeThis extends AbstractQuery } /** - * Set boost terms + * Set boost terms. + * + * @param bool $boostTerms * - * @param bool $boostTerms - * @return \Elastica\Query\MoreLikeThis - * @link http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query.html + * @return $this */ public function setBoostTerms($boostTerms) { @@ -137,10 +159,11 @@ class MoreLikeThis extends AbstractQuery } /** - * Set analyzer + * Set analyzer. * - * @param string $analyzer - * @return \Elastica\Query\MoreLikeThis + * @param string $analyzer + * + * @return $this */ public function setAnalyzer($analyzer) { @@ -150,13 +173,26 @@ class MoreLikeThis extends AbstractQuery } /** - * Set stop words + * Set stop words. + * + * @param array $stopWords * - * @param array $stopWords - * @return \Elastica\Query\MoreLikeThis + * @return $this */ public function setStopWords(array $stopWords) { return $this->setParam('stop_words', $stopWords); } + + /** + * Set minimum_should_match option. + * + * @param int|string $minimumShouldMatch + * + * @return $this + */ + public function setMinimumShouldMatch($minimumShouldMatch) + { + return $this->setParam('minimum_should_match', $minimumShouldMatch); + } } diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php b/vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php index ac2d01b3..0771f370 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php @@ -1,36 +1,35 @@ <?php - namespace Elastica\Query; /** - * Multi Match + * Multi Match. * - * @category Xodoa - * @package Elastica * @author Rodolfo Adhenawer Campagnoli Moraes <adhenawer@gmail.com> * @author Wong Wing Lun <luiges90@gmail.com> * @author Tristan Maindron <tmaindron@gmail.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/multi-match-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html */ class MultiMatch extends AbstractQuery { - const TYPE_BEST_FIELDS = 'best_fields'; - const TYPE_MOST_FIELDS = 'most_fields'; - const TYPE_CROSS_FIELDS = 'cross_fields'; - const TYPE_PHRASE = 'phrase'; + const TYPE_BEST_FIELDS = 'best_fields'; + const TYPE_MOST_FIELDS = 'most_fields'; + const TYPE_CROSS_FIELDS = 'cross_fields'; + const TYPE_PHRASE = 'phrase'; const TYPE_PHRASE_PREFIX = 'phrase_prefix'; - const OPERATOR_OR = 'or'; - const OPERATOR_AND = 'and'; + const OPERATOR_OR = 'or'; + const OPERATOR_AND = 'and'; - const ZERO_TERM_NONE = 'none'; - const ZERO_TERM_ALL = 'all'; + const ZERO_TERM_NONE = 'none'; + const ZERO_TERM_ALL = 'all'; /** - * Sets the query + * Sets the query. * - * @param string $query Query - * @return \Elastica\Query\MultiMatch Current object + * @param string $query Query + * + * @return $this */ public function setQuery($query = '') { @@ -40,8 +39,9 @@ class MultiMatch extends AbstractQuery /** * Sets Fields to be used in the query. * - * @param array $fields Fields - * @return \Elastica\Query\MultiMatch Current object + * @param array $fields Fields + * + * @return $this */ public function setFields($fields = array()) { @@ -53,8 +53,9 @@ class MultiMatch extends AbstractQuery * * If not set, defaults to true. * - * @param boolean $useDisMax - * @return \Elastica\Query\MultiMatch Current object + * @param bool $useDisMax + * + * @return $this */ public function setUseDisMax($useDisMax = true) { @@ -66,8 +67,9 @@ class MultiMatch extends AbstractQuery * * If not set, defaults to 0.0. * - * @param float $tieBreaker - * @return \Elastica\Query\MultiMatch Current object + * @param float $tieBreaker + * + * @return $this */ public function setTieBreaker($tieBreaker = 0.0) { @@ -75,12 +77,13 @@ class MultiMatch extends AbstractQuery } /** - * Sets operator for Match Query + * Sets operator for Match Query. * * If not set, defaults to 'or' * - * @param string $operator - * @return \Elastica\Query\MultiMatch Current object + * @param string $operator + * + * @return $this */ public function setOperator($operator = 'or') { @@ -88,23 +91,25 @@ class MultiMatch extends AbstractQuery } /** - * Set field minimum should match for Match Query + * Set field minimum should match for Match Query. + * + * @param mixed $minimumShouldMatch * - * @param int $minimumShouldMatch - * @return \Elastica\Query\Match + * @return $this */ public function setMinimumShouldMatch($minimumShouldMatch) { - return $this->setParam('minimum_should_match', (int) $minimumShouldMatch); + return $this->setParam('minimum_should_match', $minimumShouldMatch); } /** - * Set zero terms query for Match Query + * Set zero terms query for Match Query. * * If not set, default to 'none' * - * @param string $zeroTermQuery - * @return \Elastica\Query\Match + * @param string $zeroTermQuery + * + * @return $this */ public function setZeroTermsQuery($zeroTermQuery = 'none') { @@ -112,10 +117,11 @@ class MultiMatch extends AbstractQuery } /** - * Set cutoff frequency for Match Query + * Set cutoff frequency for Match Query. + * + * @param float $cutoffFrequency * - * @param float $cutoffFrequency - * @return \Elastica\Query\Match + * @return $this */ public function setCutoffFrequency($cutoffFrequency) { @@ -123,11 +129,12 @@ class MultiMatch extends AbstractQuery } /** - * Set type + * Set type. * - * @param string $field - * @param string $type - * @return \Elastica\Query\Match + * @param string $field + * @param string $type + * + * @return $this */ public function setType($type) { @@ -135,10 +142,11 @@ class MultiMatch extends AbstractQuery } /** - * Set fuzziness + * Set fuzziness. + * + * @param float $fuzziness * - * @param float $fuzziness - * @return \Elastica\Query\Match + * @return $this */ public function setFuzziness($fuzziness) { @@ -146,10 +154,11 @@ class MultiMatch extends AbstractQuery } /** - * Set prefix length + * Set prefix length. * - * @param int $prefixLength - * @return \Elastica\Query\Match + * @param int $prefixLength + * + * @return $this */ public function setPrefixLength($prefixLength) { @@ -157,10 +166,11 @@ class MultiMatch extends AbstractQuery } /** - * Set max expansions + * Set max expansions. + * + * @param int $maxExpansions * - * @param int $maxExpansions - * @return \Elastica\Query\Match + * @return $this */ public function setMaxExpansions($maxExpansions) { @@ -168,10 +178,11 @@ class MultiMatch extends AbstractQuery } /** - * Set analyzer + * Set analyzer. + * + * @param string $analyzer * - * @param string $analyzer - * @return \Elastica\Query\Match + * @return $this */ public function setAnalyzer($analyzer) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Nested.php b/vendor/ruflin/elastica/lib/Elastica/Query/Nested.php index 3d2f2f64..b072cfc8 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Nested.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Nested.php @@ -1,22 +1,21 @@ <?php - namespace Elastica\Query; /** - * Nested query + * Nested query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/nested-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html */ class Nested extends AbstractQuery { /** - * Adds field to mlt query + * Adds field to mlt query. + * + * @param string $path Nested object path * - * @param string $path Nested object path - * @return \Elastica\Query\Nested + * @return $this */ public function setPath($path) { @@ -24,10 +23,11 @@ class Nested extends AbstractQuery } /** - * Sets nested query + * Sets nested query. * - * @param \Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\Nested + * @param \Elastica\Query\AbstractQuery $query + * + * @return $this */ public function setQuery(AbstractQuery $query) { @@ -35,10 +35,11 @@ class Nested extends AbstractQuery } /** - * Set score method + * Set score method. + * + * @param string $scoreMode Options: avg, total, max and none. * - * @param string $scoreMode Options: avg, total, max and none. - * @return \Elastica\Query\Nested + * @return $this */ public function setScoreMode($scoreMode) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Prefix.php b/vendor/ruflin/elastica/lib/Elastica/Query/Prefix.php index 4306fd9c..c2b903ea 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Prefix.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Prefix.php @@ -1,18 +1,15 @@ <?php - namespace Elastica\Query; /** - * Prefix query + * Prefix query. * - * @category Xodoa - * @package Elastica - * @link http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html */ class Prefix extends AbstractQuery { /** - * Constructs the Prefix query object + * Constructs the Prefix query object. * * @param array $prefix OPTIONAL Calls setRawPrefix with the given $prefix array */ @@ -25,8 +22,9 @@ class Prefix extends AbstractQuery * setRawPrefix can be used instead of setPrefix if some more special * values for a prefix have to be set. * - * @param array $prefix Prefix array - * @return \Elastica\Query\Prefix Current object + * @param array $prefix Prefix array + * + * @return $this */ public function setRawPrefix(array $prefix) { @@ -34,12 +32,13 @@ class Prefix extends AbstractQuery } /** - * Adds a prefix to the prefix query + * Adds a prefix to the prefix query. + * + * @param string $key Key to query + * @param string|array $value Values(s) for the query. Boost can be set with array + * @param float $boost OPTIONAL Boost value (default = 1.0) * - * @param string $key Key to query - * @param string|array $value Values(s) for the query. Boost can be set with array - * @param float $boost OPTIONAL Boost value (default = 1.0) - * @return \Elastica\Query\Prefix Current object + * @return $this */ public function setPrefix($key, $value, $boost = 1.0) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php b/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php index 7d0b0094..89ea77cd 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php @@ -1,27 +1,26 @@ <?php - namespace Elastica\Query; + use Elastica\Exception\InvalidException; /** - * QueryString query + * QueryString query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com>, Jasper van Wanrooy <jasper@vanwanrooy.net> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html */ class QueryString extends AbstractQuery { /** - * Query string + * Query string. * * @var string Query string */ protected $_queryString = ''; /** - * Creates query string object. Calls setQuery with argument + * Creates query string object. Calls setQuery with argument. * * @param string $queryString OPTIONAL Query string for object */ @@ -31,11 +30,13 @@ class QueryString extends AbstractQuery } /** - * Sets a new query string for the object + * Sets a new query string for the object. + * + * @param string $query Query string + * + * @throws \Elastica\Exception\InvalidException If given parameter is not a string * - * @param string $query Query string - * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Query\QueryString Current object + * @return $this */ public function setQuery($query = '') { @@ -47,12 +48,13 @@ class QueryString extends AbstractQuery } /** - * Sets the default field + * Sets the default field. * * If no field is set, _all is chosen * - * @param string $field Field - * @return \Elastica\Query\QueryString Current object + * @param string $field Field + * + * @return $this */ public function setDefaultField($field) { @@ -60,12 +62,13 @@ class QueryString extends AbstractQuery } /** - * Sets the default operator AND or OR + * Sets the default operator AND or OR. * * If no operator is set, OR is chosen * - * @param string $operator Operator - * @return \Elastica\Query\QueryString Current object + * @param string $operator Operator + * + * @return $this */ public function setDefaultOperator($operator) { @@ -75,8 +78,9 @@ class QueryString extends AbstractQuery /** * Sets the analyzer to analyze the query with. * - * @param string $analyzer Analyser to use - * @return \Elastica\Query\QueryString Current object + * @param string $analyzer Analyser to use + * + * @return $this */ public function setAnalyzer($analyzer) { @@ -88,8 +92,9 @@ class QueryString extends AbstractQuery * * If not set, defaults to true. * - * @param bool $allow - * @return \Elastica\Query\QueryString Current object + * @param bool $allow + * + * @return $this */ public function setAllowLeadingWildcard($allow = true) { @@ -97,25 +102,13 @@ class QueryString extends AbstractQuery } /** - * Sets the parameter to auto-lowercase terms of some queries. - * - * If not set, defaults to true. - * - * @param bool $lowercase - * @return \Elastica\Query\QueryString Current object - */ - public function setLowercaseExpandedTerms($lowercase = true) - { - return $this->setParam('lowercase_expanded_terms', (bool) $lowercase); - } - - /** * Sets the parameter to enable the position increments in result queries. * * If not set, defaults to true. * - * @param bool $enabled - * @return \Elastica\Query\QueryString Current object + * @param bool $enabled + * + * @return $this */ public function setEnablePositionIncrements($enabled = true) { @@ -127,8 +120,9 @@ class QueryString extends AbstractQuery * * If not set, defaults to 0. * - * @param int $length - * @return \Elastica\Query\QueryString Current object + * @param int $length + * + * @return $this */ public function setFuzzyPrefixLength($length = 0) { @@ -140,8 +134,9 @@ class QueryString extends AbstractQuery * * If not set, defaults to 0.5 * - * @param float $minSim - * @return \Elastica\Query\QueryString Current object + * @param float $minSim + * + * @return $this */ public function setFuzzyMinSim($minSim = 0.5) { @@ -154,8 +149,9 @@ class QueryString extends AbstractQuery * If zero, exact phrases are required. * If not set, defaults to zero. * - * @param int $phraseSlop - * @return \Elastica\Query\QueryString Current object + * @param int $phraseSlop + * + * @return $this */ public function setPhraseSlop($phraseSlop = 0) { @@ -167,8 +163,9 @@ class QueryString extends AbstractQuery * * If not set, defaults to 1.0. * - * @param float $boost - * @return \Elastica\Query\QueryString Current object + * @param float $boost + * + * @return $this */ public function setBoost($boost = 1.0) { @@ -180,8 +177,9 @@ class QueryString extends AbstractQuery * * If not set, defaults to true * - * @param bool $analyze - * @return \Elastica\Query\QueryString Current object + * @param bool $analyze + * + * @return $this */ public function setAnalyzeWildcard($analyze = true) { @@ -193,8 +191,9 @@ class QueryString extends AbstractQuery * * If not set, defaults to true. * - * @param bool $autoGenerate - * @return \Elastica\Query\QueryString Current object + * @param bool $autoGenerate + * + * @return $this */ public function setAutoGeneratePhraseQueries($autoGenerate = true) { @@ -202,13 +201,13 @@ class QueryString extends AbstractQuery } /** - * Sets the fields + * Sets the fields. If no fields are set, _all is chosen. + * + * @param array $fields Fields * - * If no fields are set, _all is chosen + * @throws \Elastica\Exception\InvalidException If given parameter is not an array * - * @param array $fields Fields - * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Query\QueryString Current object + * @return $this */ public function setFields(array $fields) { @@ -222,8 +221,9 @@ class QueryString extends AbstractQuery /** * Whether to use bool or dis_max queries to internally combine results for multi field search. * - * @param bool $value Determines whether to use - * @return \Elastica\Query\QueryString Current object + * @param bool $value Determines whether to use + * + * @return $this */ public function setUseDisMax($value = true) { @@ -235,8 +235,9 @@ class QueryString extends AbstractQuery * * If not set, defaults to 0. * - * @param int $tieBreaker - * @return \Elastica\Query\QueryString Current object + * @param int $tieBreaker + * + * @return $this */ public function setTieBreaker($tieBreaker = 0) { @@ -244,24 +245,38 @@ class QueryString extends AbstractQuery } /** - * Set a re-write condition. See https://github.com/elasticsearch/elasticsearch/issues/1186 for additional information + * Set a re-write condition. See https://github.com/elasticsearch/elasticsearch/issues/1186 for additional information. * - * @param string $rewrite - * @return \Elastica\Query\QueryString Current object + * @param string $rewrite + * + * @return $this */ - public function setRewrite($rewrite = "") + public function setRewrite($rewrite = '') { return $this->setParam('rewrite', $rewrite); } /** - * Converts query to array + * Set timezone option. + * + * @param string $timezone + * + * @return $this + */ + public function setTimezone($timezone) + { + return $this->setParam('time_zone', $timezone); + } + + /** + * Converts query to array. * * @see \Elastica\Query\AbstractQuery::toArray() + * * @return array Query array */ public function toArray() { - return array('query_string' => array_merge(array('query' => $this->_queryString), $this->getParams()),); + return array('query_string' => array_merge(array('query' => $this->_queryString), $this->getParams())); } } diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Range.php b/vendor/ruflin/elastica/lib/Elastica/Query/Range.php index 54b79027..b2f9175a 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Range.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Range.php @@ -1,19 +1,17 @@ <?php - namespace Elastica\Query; /** - * Range query + * Range query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/range-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html */ class Range extends AbstractQuery { /** - * Constructor + * Constructor. * * @param string $fieldName Field name * @param array $args Field arguments @@ -26,11 +24,12 @@ class Range extends AbstractQuery } /** - * Adds a range field to the query + * Adds a range field to the query. + * + * @param string $fieldName Field name + * @param array $args Field arguments * - * @param string $fieldName Field name - * @param array $args Field arguments - * @return \Elastica\Query\Range Current object + * @return $this */ public function addField($fieldName, array $args) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Regexp.php b/vendor/ruflin/elastica/lib/Elastica/Query/Regexp.php new file mode 100644 index 00000000..22a48560 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Regexp.php @@ -0,0 +1,40 @@ +<?php +namespace Elastica\Query; + +/** + * Regexp query. + * + * @author Aurélien Le Grand <gnitg@yahoo.fr> + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html + */ +class Regexp extends AbstractQuery +{ + /** + * Construct regexp query. + * + * @param string $key OPTIONAL Regexp key + * @param string $value OPTIONAL Regexp value + * @param float $boost OPTIONAL Boost value (default = 1) + */ + public function __construct($key = '', $value = null, $boost = 1.0) + { + if (!empty($key)) { + $this->setValue($key, $value, $boost); + } + } + + /** + * Sets the query expression for a key with its boost value. + * + * @param string $key + * @param string $value + * @param float $boost + * + * @return $this + */ + public function setValue($key, $value, $boost = 1.0) + { + return $this->setParam($key, array('value' => $value, 'boost' => $boost)); + } +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Simple.php b/vendor/ruflin/elastica/lib/Elastica/Query/Simple.php index 2448ca79..6ba9310d 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Simple.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Simple.php @@ -1,26 +1,23 @@ <?php - namespace Elastica\Query; /** * Simple query * Pure php array query. Can be used to create any not existing type of query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> */ class Simple extends AbstractQuery { /** - * Query + * Query. * * @var array Query */ protected $_query = array(); /** - * Constructs a query based on an array + * Constructs a query based on an array. * * @param array $query Query array */ @@ -30,10 +27,11 @@ class Simple extends AbstractQuery } /** - * Sets new query array + * Sets new query array. + * + * @param array $query Query array * - * @param array $query Query array - * @return \Elastica\Query\Simple Current object + * @return $this */ public function setQuery(array $query) { @@ -43,9 +41,10 @@ class Simple extends AbstractQuery } /** - * Converts query to array + * Converts query to array. * * @return array Query array + * * @see \Elastica\Query\AbstractQuery::toArray() */ public function toArray() diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php b/vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php index a6c4ba9d..c2302d44 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php @@ -1,20 +1,19 @@ <?php - namespace Elastica\Query; /** - * Class SimpleQueryString - * @package Elastica\Query - * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html + * Class SimpleQueryString. + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html */ class SimpleQueryString extends AbstractQuery { - const OPERATOR_AND = "and"; - const OPERATOR_OR = "or"; + const OPERATOR_AND = 'and'; + const OPERATOR_OR = 'or'; /** * @param string $query - * @param array $fields + * @param array $fields */ public function __construct($query, array $fields = array()) { @@ -25,41 +24,60 @@ class SimpleQueryString extends AbstractQuery } /** - * Set the querystring for this query + * Set the querystring for this query. + * * @param string $query see ES documentation for querystring syntax - * @return \Elastica\Query\SimpleQueryString + * + * @return $this */ public function setQuery($query) { - return $this->setParam("query", $query); + return $this->setParam('query', $query); } /** * @param string[] $fields the fields on which to perform this query. Defaults to index.query.default_field. - * @return \Elastica\Query\SimpleQueryString + * + * @return $this */ public function setFields(array $fields) { - return $this->setParam("fields", $fields); + return $this->setParam('fields', $fields); } /** - * Set the default operator to use if no explicit operator is defined in the query string + * Set the default operator to use if no explicit operator is defined in the query string. + * * @param string $operator see OPERATOR_* constants for options - * @return \Elastica\Query\SimpleQueryString + * + * @return $this */ public function setDefaultOperator($operator) { - return $this->setParam("default_operator", $operator); + return $this->setParam('default_operator', $operator); } /** - * Set the analyzer used to analyze each term of the query + * Set the analyzer used to analyze each term of the query. + * * @param string $analyzer - * @return \Elastica\Query\SimpleQueryString + * + * @return $this */ public function setAnalyzer($analyzer) { - return $this->setParam("analyzer", $analyzer); + return $this->setParam('analyzer', $analyzer); + } + + /** + * Set minimum_should_match option. + * + * @param int|string $minimumShouldMatch + * + * @return $this + */ + public function setMinimumShouldMatch($minimumShouldMatch) + { + return $this->setParam('minimum_should_match', $minimumShouldMatch); } -}
\ No newline at end of file +} diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Term.php b/vendor/ruflin/elastica/lib/Elastica/Query/Term.php index eb20eb86..8cfe0a88 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Term.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Term.php @@ -1,19 +1,17 @@ <?php - namespace Elastica\Query; /** - * Term query + * Term query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/term-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html */ class Term extends AbstractQuery { /** - * Constructs the Term query object + * Constructs the Term query object. * * @param array $term OPTIONAL Calls setTerm with the given $term array */ @@ -26,8 +24,9 @@ class Term extends AbstractQuery * Set term can be used instead of addTerm if some more special * values for a term have to be set. * - * @param array $term Term array - * @return \Elastica\Query\Term Current object + * @param array $term Term array + * + * @return $this */ public function setRawTerm(array $term) { @@ -35,12 +34,13 @@ class Term extends AbstractQuery } /** - * 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 float $boost OPTIONAL Boost value (default = 1.0) * - * @param string $key Key to query - * @param string|array $value Values(s) for the query. Boost can be set with array - * @param float $boost OPTIONAL Boost value (default = 1.0) - * @return \Elastica\Query\Term Current object + * @return $this */ public function setTerm($key, $value, $boost = 1.0) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Terms.php b/vendor/ruflin/elastica/lib/Elastica/Query/Terms.php index 41cc9216..54f26461 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Terms.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Terms.php @@ -1,41 +1,40 @@ <?php - namespace Elastica\Query; + use Elastica\Exception\InvalidException; /** - * Terms query + * Terms query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/terms-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html */ class Terms extends AbstractQuery { /** - * 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 = ''; /** - * Construct terms query + * Construct terms query. * * @param string $key OPTIONAL Terms key * @param array $terms OPTIONAL Terms list @@ -46,11 +45,12 @@ class Terms extends AbstractQuery } /** - * Sets key and terms for the query + * Sets key and terms for the query. + * + * @param string $key Terms key + * @param array $terms Terms for the query. * - * @param string $key Terms key - * @param array $terms Terms for the query. - * @return \Elastica\Query\Terms + * @return $this */ public function setTerms($key, array $terms) { @@ -61,10 +61,11 @@ class Terms extends AbstractQuery } /** - * Adds a single term to the list + * Adds a single term to the list. * - * @param string $term Term - * @return \Elastica\Query\Terms + * @param string $term Term + * + * @return $this */ public function addTerm($term) { @@ -74,10 +75,11 @@ class Terms extends AbstractQuery } /** - * Sets the minimum matching values + * Sets the minimum matching values. + * + * @param int $minimum Minimum value * - * @param int $minimum Minimum value - * @return \Elastica\Query\Terms + * @return $this */ public function setMinimumMatch($minimum) { @@ -85,11 +87,13 @@ class Terms extends AbstractQuery } /** - * Converts the terms object to an array + * Converts the terms object to an array. * * @see \Elastica\Query\AbstractQuery::toArray() - * @throws \Elastica\Exception\InvalidException - * @return array Query array + * + * @throws \Elastica\Exception\InvalidException If term key is empty + * + * @return array Query array */ public function toArray() { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/TopChildren.php b/vendor/ruflin/elastica/lib/Elastica/Query/TopChildren.php index baaf7501..6f15c79d 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/TopChildren.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/TopChildren.php @@ -1,23 +1,22 @@ <?php - namespace Elastica\Query; + use Elastica\Query as BaseQuery; /** * Runs the child query with an estimated hits size, and out of the hit docs, aggregates it into parent docs. * - * @category Xodoa - * @package Elastica * @author Wu Yang <darkyoung@gmail.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/top-children-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-top-children-query.html */ class TopChildren extends AbstractQuery { /** - * Construct topChildren query + * Construct topChildren query. * * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @param string $type Parent document type + * @param string $type Parent document type */ public function __construct($query, $type = null) { @@ -26,10 +25,11 @@ class TopChildren extends AbstractQuery } /** - * Sets query object + * Sets query object. * - * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\TopChildren + * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query + * + * @return $this */ public function setQuery($query) { @@ -40,10 +40,11 @@ class TopChildren extends AbstractQuery } /** - * Set type of the parent document + * Set type of the parent document. + * + * @param string $type Parent document type * - * @param string $type Parent document type - * @return \Elastica\Query\TopChildren Current object + * @return $this */ public function setType($type) { diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Wildcard.php b/vendor/ruflin/elastica/lib/Elastica/Query/Wildcard.php index 68aca67e..bfa5e751 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/Wildcard.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/Wildcard.php @@ -1,19 +1,17 @@ <?php - namespace Elastica\Query; /** - * Wildcard query + * Wildcard query. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/wildcard-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html */ class Wildcard extends AbstractQuery { /** - * Construct wildcard query + * Construct wildcard query. * * @param string $key OPTIONAL Wildcard key * @param string $value OPTIONAL Wildcard value @@ -27,12 +25,13 @@ class Wildcard extends AbstractQuery } /** - * Sets the query expression for a key with its boost value + * Sets the query expression for a key with its boost value. + * + * @param string $key + * @param string $value + * @param float $boost * - * @param string $key - * @param string $value - * @param float $boost - * @return \Elastica\Query\Wildcard + * @return $this */ public function setValue($key, $value, $boost = 1.0) { |