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/Facet/TermsStats.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Facet/TermsStats.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Facet/TermsStats.php | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Facet/TermsStats.php b/vendor/ruflin/elastica/lib/Elastica/Facet/TermsStats.php index 61c6b39e..22d284c5 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Facet/TermsStats.php +++ b/vendor/ruflin/elastica/lib/Elastica/Facet/TermsStats.php @@ -1,5 +1,4 @@ <?php - namespace Elastica\Facet; use Elastica\Exception\InvalidException; @@ -7,14 +6,13 @@ use Elastica\Exception\InvalidException; /** * Implements the statistical facet on a per term basis. * - * @category Xodoa - * @package Elastica * @author Tom Michaelis <tom.michaelis@gmail.com> - * @link http://www.elasticsearch.org/guide/reference/api/search/facets/terms-stats-facet.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/search-facets-terms-stats-facet.html + * @deprecated Facets are deprecated and will be removed in a future release. You are encouraged to migrate to aggregations instead. */ class TermsStats extends AbstractFacet { - /** * Holds the types of ordering which are allowed * by Elasticsearch. @@ -23,63 +21,69 @@ class TermsStats extends AbstractFacet */ protected $_orderTypes = array('term', 'reverse_term', 'count', 'reverse_count', 'total', 'reverse_total', 'min', 'reverse_min', 'max', 'reverse_max', 'mean', - 'reverse_mean'); + 'reverse_mean', ); /** * Sets the key field for the query. * - * @param string $keyField The key field name for the query. - * @return \Elastica\Facet\TermsStats + * @param string $keyField The key field name for the query. + * + * @return $this */ - public function setKeyField( $keyField ) + public function setKeyField($keyField) { - return $this->setParam( 'key_field', $keyField ); + return $this->setParam('key_field', $keyField); } /** - * Sets a script to calculate statistical information on a per term basis + * Sets a script to calculate statistical information on a per term basis. + * + * @param string $valueScript The script to do calculations on the statistical values * - * @param string $valueScript The script to do calculations on the statistical values - * @return \Elastica\Facet\TermsStats + * @return $this */ - public function setValueScript( $valueScript ) + public function setValueScript($valueScript) { - return $this->setParam( 'value_script', $valueScript ); + return $this->setParam('value_script', $valueScript); } /** * Sets the ordering type for this facet. Elasticsearch * internal default is count. * - * @param string $type The order type to set use for sorting of the terms. + * @param string $type The order type to set use for sorting of the terms. + * * @throws \Elastica\Exception\InvalidException When an invalid order type was set. - * @return \Elastica\Facet\TermsStats + * + * @return $this */ public function setOrder($type) { if (!in_array($type, $this->_orderTypes)) { - throw new InvalidException('Invalid order type: ' . $type); + throw new InvalidException('Invalid order type: '.$type); } return $this->setParam('order', $type); } /** - * Sets a field to compute basic statistical results on + * Sets a field to compute basic statistical results on. + * + * @param string $valueField The field to compute statistical values for * - * @param string $valueField The field to compute statistical values for - * @return \Elastica\Facet\TermsStats + * @return $this */ - public function setValueField( $valueField ) + public function setValueField($valueField) { - return $this->setParam( 'value_field', $valueField ); + return $this->setParam('value_field', $valueField); } /** * Sets the amount of terms to be returned. * - * @param int $size The amount of terms to be returned. - * @return \Elastica\Facet\Terms + * @param int $size The amount of terms to be returned. + * + * @return $this */ public function setSize($size) { @@ -91,13 +95,13 @@ class TermsStats extends AbstractFacet * facet definition of the parent. * * @see \Elastica\Facet\AbstractFacet::toArray() + * * @return array */ public function toArray() { - $this->_setFacetParam( 'terms_stats', $this->_params ); + $this->_setFacetParam('terms_stats', $this->_params); return parent::toArray(); } - } |