diff options
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Query/Common.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Query/Common.php | 92 |
1 files changed, 57 insertions, 35 deletions
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 +} |