diff --git a/lib/Elastica/AbstractUpdateAction.php b/lib/Elastica/AbstractUpdateAction.php index 0f7c0203d4..158c973ac6 100644 --- a/lib/Elastica/AbstractUpdateAction.php +++ b/lib/Elastica/AbstractUpdateAction.php @@ -20,8 +20,8 @@ class AbstractUpdateAction extends Param /** * Sets the id of the document. * - * @param string $id - * @return \Elastica\Document + * @param string $id + * @return $this */ public function setId($id) { @@ -49,8 +49,8 @@ public function hasId() /** * Sets lifetime of document * - * @param string $ttl - * @return \Elastica\Document + * @param string $ttl + * @return $this */ public function setTtl($ttl) { @@ -76,8 +76,8 @@ public function hasTtl() /** * Sets the document type name * - * @param string $type Type name - * @return \Elastica\Document Current object + * @param string $type Type name + * @return $this */ public function setType($type) { @@ -92,8 +92,9 @@ public function setType($type) /** * Return document type name * - * @return string Document type name * @throws \Elastica\Exception\InvalidException + * + * @return string Document type name */ public function getType() { @@ -103,8 +104,8 @@ public function getType() /** * Sets the document index name * - * @param string $index Index name - * @return \Elastica\Document Current object + * @param string $index Index name + * @return $this */ public function setIndex($index) { @@ -118,8 +119,9 @@ public function setIndex($index) /** * Get the document index name * - * @return string Index name * @throws \Elastica\Exception\InvalidException + * + * @return string Index name */ public function getIndex() { @@ -129,8 +131,8 @@ public function getIndex() /** * Sets the version of a document for use with optimistic concurrency control * - * @param int $version Document version - * @return \Elastica\Document Current object + * @param int $version Document version + * @return $this * @link http://www.elasticsearch.org/blog/2011/02/08/versioning.html */ public function setVersion($version) @@ -160,8 +162,8 @@ public function hasVersion() * Sets the version_type of a document * Default in ES is internal, but you can set to external to use custom versioning * - * @param int $versionType Document version type - * @return \Elastica\Document Current object + * @param int $versionType Document version type + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/index_.html */ public function setVersionType($versionType) @@ -190,8 +192,8 @@ public function hasVersionType() /** * Sets parent document id * - * @param string|int $parent Parent document id - * @return \Elastica\Document Current object + * @param string|int $parent Parent document id + * @return $this * @link http://www.elasticsearch.org/guide/reference/mapping/parent-field.html */ public function setParent($parent) @@ -220,8 +222,8 @@ public function hasParent() /** * Set operation type * - * @param string $opType Only accept create - * @return \Elastica\Document Current object + * @param string $opType Only accept create + * @return $this */ public function setOpType($opType) { @@ -248,8 +250,8 @@ public function hasOpType() /** * Set percolate query param * - * @param string $value percolator filter - * @return \Elastica\Document + * @param string $value percolator filter + * @return $this */ public function setPercolate($value = '*') { @@ -277,8 +279,8 @@ public function hasPercolate() /** * Set routing query param * - * @param string $value routing - * @return \Elastica\Document + * @param string $value routing + * @return $this */ public function setRouting($value) { @@ -304,8 +306,8 @@ public function hasRouting() } /** - * @param array|string $fields - * @return \Elastica\Document + * @param array|string $fields + * @return $this */ public function setFields($fields) { @@ -317,7 +319,7 @@ public function setFields($fields) } /** - * @return \Elastica\Document + * @return $this */ public function setFieldsSource() { @@ -341,8 +343,8 @@ public function hasFields() } /** - * @param int $num - * @return \Elastica\Document + * @param int $num + * @return $this */ public function setRetryOnConflict($num) { @@ -366,8 +368,8 @@ public function hasRetryOnConflict() } /** - * @param string $timestamp - * @return \Elastica\Document + * @param string $timestamp + * @return $this */ public function setTimestamp($timestamp) { @@ -391,8 +393,8 @@ public function hasTimestamp() } /** - * @param bool $refresh - * @return \Elastica\Document + * @param bool $refresh + * @return $this */ public function setRefresh($refresh = true) { @@ -416,8 +418,8 @@ public function hasRefresh() } /** - * @param string $timeout - * @return \Elastica\Document + * @param string $timeout + * @return $this */ public function setTimeout($timeout) { @@ -441,8 +443,8 @@ public function hasTimeout() } /** - * @param string $timeout - * @return \Elastica\Document + * @param string $timeout + * @return $this */ public function setConsistency($timeout) { @@ -466,8 +468,8 @@ public function hasConsistency() } /** - * @param string $timeout - * @return \Elastica\Document + * @param string $timeout + * @return $this */ public function setReplication($timeout) { @@ -492,7 +494,7 @@ public function hasReplication() /** * @param \Elastica\Document|array $data - * @return \Elastica\Document + * @return $this */ public function setUpsert($data) { diff --git a/lib/Elastica/Aggregation/AbstractAggregation.php b/lib/Elastica/Aggregation/AbstractAggregation.php index 523dbd5a39..f5db051da2 100644 --- a/lib/Elastica/Aggregation/AbstractAggregation.php +++ b/lib/Elastica/Aggregation/AbstractAggregation.php @@ -8,14 +8,12 @@ abstract class AbstractAggregation extends Param { /** - * The name of this aggregation - * @var string + * @var string The name of this aggregation */ protected $_name; /** - * Subaggregations belonging to this aggregation - * @var array + * @var array Subaggregations belonging to this aggregation */ protected $_aggs = array(); @@ -34,6 +32,8 @@ public function __construct($name) public function setName($name) { $this->_name = $name; + + return $this; } /** @@ -56,8 +56,9 @@ public function getAggs() /** * Add a sub-aggregation - * @param AbstractAggregation $aggregation * @throws \Elastica\Exception\InvalidException + * + * @param AbstractAggregation $aggregation * @return $this */ public function addAggregation(AbstractAggregation $aggregation) diff --git a/lib/Elastica/Aggregation/AbstractSimpleAggregation.php b/lib/Elastica/Aggregation/AbstractSimpleAggregation.php index 57b663d627..d1522fa714 100644 --- a/lib/Elastica/Aggregation/AbstractSimpleAggregation.php +++ b/lib/Elastica/Aggregation/AbstractSimpleAggregation.php @@ -8,7 +8,7 @@ abstract class AbstractSimpleAggregation extends AbstractAggregation { /** * Set the field for this aggregation - * @param string $field the name of the document field on which to perform this aggregation + * @param string $field the name of the document field on which to perform this aggregation * @return $this */ public function setField($field) @@ -18,7 +18,7 @@ public function setField($field) /** * Set a script for this aggregation - * @param string|Script $script + * @param string|Script $script * @return $this */ public function setScript($script) diff --git a/lib/Elastica/Aggregation/DateHistogram.php b/lib/Elastica/Aggregation/DateHistogram.php index f88aed5ec9..7f2ed2a61e 100644 --- a/lib/Elastica/Aggregation/DateHistogram.php +++ b/lib/Elastica/Aggregation/DateHistogram.php @@ -11,8 +11,8 @@ class DateHistogram extends Histogram { /** * Set pre-rounding based on interval - * @param string $preZone - * @return DateHistogram + * @param string $preZone + * @return $this */ public function setPreZone($preZone) { @@ -21,8 +21,8 @@ public function setPreZone($preZone) /** * Set post-rounding based on interval - * @param string $postZone - * @return DateHistogram + * @param string $postZone + * @return $this */ public function setPostZone($postZone) { @@ -31,8 +31,8 @@ public function setPostZone($postZone) /** * Set pre-zone adjustment for larger time intervals (day and above) - * @param string $adjust - * @return DateHistogram + * @param string $adjust + * @return $this */ public function setPreZoneAdjustLargeInterval($adjust) { @@ -41,8 +41,8 @@ public function setPreZoneAdjustLargeInterval($adjust) /** * Adjust for granularity of date data - * @param int $factor set to 1000 if date is stored in seconds rather than milliseconds - * @return DateHistogram + * @param int $factor set to 1000 if date is stored in seconds rather than milliseconds + * @return $this */ public function setFactor($factor) { @@ -51,8 +51,8 @@ public function setFactor($factor) /** * Set the offset for pre-rounding - * @param string $offset "1d", for example - * @return DateHistogram + * @param string $offset "1d", for example + * @return $this */ public function setPreOffset($offset) { @@ -61,8 +61,8 @@ public function setPreOffset($offset) /** * Set the offset for post-rounding - * @param string $offset "1d", for example - * @return DateHistogram + * @param string $offset "1d", for example + * @return $this */ public function setPostOffset($offset) { @@ -72,8 +72,8 @@ public function setPostOffset($offset) /** * Set the format for returned bucket key_as_string values * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-aggregations-bucket-daterange-aggregation.html#date-format-pattern - * @param string $format see link for formatting options - * @return DateHistogram + * @param string $format see link for formatting options + * @return $this */ public function setFormat($format) { diff --git a/lib/Elastica/Aggregation/DateRange.php b/lib/Elastica/Aggregation/DateRange.php index 9835033a50..48417835da 100644 --- a/lib/Elastica/Aggregation/DateRange.php +++ b/lib/Elastica/Aggregation/DateRange.php @@ -12,7 +12,7 @@ class DateRange extends Range /** * Set the formatting for the returned date values * @param string $format see documentation for formatting options - * @return Range + * @return $this */ public function setFormat($format) { diff --git a/lib/Elastica/Aggregation/Filter.php b/lib/Elastica/Aggregation/Filter.php index 291d4e6c6e..84c1940035 100644 --- a/lib/Elastica/Aggregation/Filter.php +++ b/lib/Elastica/Aggregation/Filter.php @@ -14,7 +14,7 @@ class Filter extends AbstractAggregation /** * Set the filter for this aggregation * @param AbstractFilter $filter - * @return Filter + * @return $this */ public function setFilter(AbstractFilter $filter) { diff --git a/lib/Elastica/Aggregation/Filters.php b/lib/Elastica/Aggregation/Filters.php index 9ccab87705..f1dd7bbe3e 100644 --- a/lib/Elastica/Aggregation/Filters.php +++ b/lib/Elastica/Aggregation/Filters.php @@ -18,7 +18,7 @@ class Filters extends AbstractAggregation * * @param AbstractFilter $filter * @param string $name - * @return Filters + * @return $this */ public function addFilter(AbstractFilter $filter, $name = '') { diff --git a/lib/Elastica/Aggregation/GeoDistance.php b/lib/Elastica/Aggregation/GeoDistance.php index 8c49cc488d..eaf1e23d17 100644 --- a/lib/Elastica/Aggregation/GeoDistance.php +++ b/lib/Elastica/Aggregation/GeoDistance.php @@ -28,8 +28,8 @@ public function __construct($name, $field, $origin) /** * Set the field for this aggregation - * @param string $field the name of the document field on which to perform this aggregation - * @return GeoDistance + * @param string $field the name of the document field on which to perform this aggregation + * @return $this */ public function setField($field) { @@ -39,7 +39,7 @@ public function setField($field) /** * Set the origin point from which distances will be calculated * @param string|array $origin valid formats are array("lat" => 52.3760, "lon" => 4.894), "52.3760, 4.894", and array(4.894, 52.3760) - * @return GeoDistance + * @return $this */ public function setOrigin($origin) { @@ -48,20 +48,24 @@ public function setOrigin($origin) /** * Add a distance range to this aggregation - * @param int $fromValue a distance - * @param int $toValue a distance - * @return GeoDistance * @throws \Elastica\Exception\InvalidException + * + * @param int $fromValue a distance + * @param int $toValue a distance + * @return $this */ public function addRange($fromValue = null, $toValue = null) { if (is_null($fromValue) && is_null($toValue)) { throw new InvalidException("Either fromValue or toValue must be set. Both cannot be null."); } + $range = array(); + if (!is_null($fromValue)) { $range['from'] = $fromValue; } + if (!is_null($toValue)) { $range['to'] = $toValue; } @@ -71,8 +75,8 @@ public function addRange($fromValue = null, $toValue = null) /** * Set the unit of distance measure for this aggregation - * @param string $unit defaults to km - * @return GeoDistance + * @param string $unit defaults to km + * @return $this */ public function setUnit($unit) { @@ -81,8 +85,8 @@ public function setUnit($unit) /** * Set the method by which distances will be calculated - * @param string $distanceType see DISTANCE_TYPE_* constants for options. Defaults to sloppy_arc. - * @return GeoDistance + * @param string $distanceType see DISTANCE_TYPE_* constants for options. Defaults to sloppy_arc. + * @return $this */ public function setDistanceType($distanceType) { diff --git a/lib/Elastica/Aggregation/GeohashGrid.php b/lib/Elastica/Aggregation/GeohashGrid.php index 86f6f502df..963111a4a6 100644 --- a/lib/Elastica/Aggregation/GeohashGrid.php +++ b/lib/Elastica/Aggregation/GeohashGrid.php @@ -21,8 +21,8 @@ public function __construct($name, $field) /** * Set the field for this aggregation - * @param string $field the name of the document field on which to perform this aggregation - * @return GeohashGrid + * @param string $field the name of the document field on which to perform this aggregation + * @return $this */ public function setField($field) { @@ -31,8 +31,8 @@ public function setField($field) /** * Set the precision for this aggregation - * @param int $precision an integer between 1 and 12, inclusive. Defaults to 5. - * @return GeohashGrid + * @param int $precision an integer between 1 and 12, inclusive. Defaults to 5. + * @return $this */ public function setPrecision($precision) { @@ -41,8 +41,8 @@ public function setPrecision($precision) /** * Set the maximum number of buckets to return - * @param int $size defaults to 10,000 - * @return GeohashGrid + * @param int $size defaults to 10,000 + * @return $this */ public function setSize($size) { @@ -51,8 +51,8 @@ public function setSize($size) /** * Set the number of results returned from each shard - * @param int $shardSize - * @return GeohashGrid + * @param int $shardSize + * @return $this */ public function setShardSize($shardSize) { diff --git a/lib/Elastica/Aggregation/Histogram.php b/lib/Elastica/Aggregation/Histogram.php index 2626528f07..a0be5c9ee4 100644 --- a/lib/Elastica/Aggregation/Histogram.php +++ b/lib/Elastica/Aggregation/Histogram.php @@ -23,7 +23,7 @@ public function __construct($name, $field, $interval) /** * Set the interval by which documents will be bucketed - * @param int $interval + * @param int $interval * @return $this */ public function setInterval($interval) @@ -33,8 +33,8 @@ public function setInterval($interval) /** * Set the bucket sort order - * @param string $order "_count", "_term", or the name of a sub-aggregation or sub-aggregation response field - * @param string $direction "asc" or "desc" + * @param string $order "_count", "_term", or the name of a sub-aggregation or sub-aggregation response field + * @param string $direction "asc" or "desc" * @return $this */ public function setOrder($order, $direction) @@ -44,7 +44,7 @@ public function setOrder($order, $direction) /** * Set the minimum number of documents which must fall into a bucket in order for the bucket to be returned - * @param int $count set to 0 to include empty buckets + * @param int $count set to 0 to include empty buckets * @return $this */ public function setMinimumDocumentCount($count) diff --git a/lib/Elastica/Aggregation/IpRange.php b/lib/Elastica/Aggregation/IpRange.php index 9b58ff8312..58c83dbb48 100644 --- a/lib/Elastica/Aggregation/IpRange.php +++ b/lib/Elastica/Aggregation/IpRange.php @@ -23,8 +23,8 @@ public function __construct($name, $field) /** * Set the field for this aggregation - * @param string $field the name of the document field on which to perform this aggregation - * @return IpRange + * @param string $field the name of the document field on which to perform this aggregation + * @return $this */ public function setField($field) { @@ -35,7 +35,7 @@ public function setField($field) * Add an ip range to this aggregation * @param string $fromValue a valid ipv4 address. Low end of this range, exclusive (greater than) * @param string $toValue a valid ipv4 address. High end of this range, exclusive (less than) - * @return IpRange + * @return $this * @throws \Elastica\Exception\InvalidException */ public function addRange($fromValue = null, $toValue = null) @@ -56,8 +56,8 @@ public function addRange($fromValue = null, $toValue = null) /** * Add an ip range in the form of a CIDR mask - * @param string $mask a valid CIDR mask - * @return IpRange + * @param string $mask a valid CIDR mask + * @return $this */ public function addMaskRange($mask) { diff --git a/lib/Elastica/Aggregation/Missing.php b/lib/Elastica/Aggregation/Missing.php index 8c233c23ad..2a2aeff9a7 100644 --- a/lib/Elastica/Aggregation/Missing.php +++ b/lib/Elastica/Aggregation/Missing.php @@ -21,8 +21,8 @@ public function __construct($name, $field) /** * Set the field for this aggregation - * @param string $field the name of the document field on which to perform this aggregation - * @return Missing + * @param string $field the name of the document field on which to perform this aggregation + * @return $this */ public function setField($field) { diff --git a/lib/Elastica/Aggregation/Nested.php b/lib/Elastica/Aggregation/Nested.php index 1945d8440c..5af1cdc770 100644 --- a/lib/Elastica/Aggregation/Nested.php +++ b/lib/Elastica/Aggregation/Nested.php @@ -22,7 +22,7 @@ public function __construct($name, $path) /** * Set the nested path for this aggregation * @param string $path - * @return Nested + * @return $this */ public function setPath($path) { diff --git a/lib/Elastica/Aggregation/Range.php b/lib/Elastica/Aggregation/Range.php index 68d55c9e4e..6361620fc6 100644 --- a/lib/Elastica/Aggregation/Range.php +++ b/lib/Elastica/Aggregation/Range.php @@ -23,13 +23,17 @@ public function addRange($fromValue = null, $toValue = null, $key = null) if (is_null($fromValue) && is_null($toValue)) { throw new InvalidException("Either fromValue or toValue must be set. Both cannot be null."); } + $range = array(); + if (!is_null($fromValue)) { $range['from'] = $fromValue; } + if (!is_null($toValue)) { $range['to'] = $toValue; } + if (!is_null($key)) { $range['key'] = $key; } diff --git a/lib/Elastica/Aggregation/ReverseNested.php b/lib/Elastica/Aggregation/ReverseNested.php index d641dec7e3..510153a074 100644 --- a/lib/Elastica/Aggregation/ReverseNested.php +++ b/lib/Elastica/Aggregation/ReverseNested.php @@ -26,8 +26,8 @@ public function __construct($name, $path = null) /** * Set the nested path for this aggregation * - * @param string $path - * @return ReverseNested + * @param string $path + * @return $this */ public function setPath($path) { diff --git a/lib/Elastica/Aggregation/ScriptedMetric.php b/lib/Elastica/Aggregation/ScriptedMetric.php index 1c2e159881..4c42c50d23 100644 --- a/lib/Elastica/Aggregation/ScriptedMetric.php +++ b/lib/Elastica/Aggregation/ScriptedMetric.php @@ -38,8 +38,7 @@ public function __construct($name, $initScript = null, $mapScript = null, $combi * Set the field for this aggregation * * @param string $script the name of the document field on which to perform this aggregation - * - * @return static + * @return $this */ public function setCombineScript($script) { @@ -50,8 +49,7 @@ public function setCombineScript($script) * Set the field for this aggregation * * @param string $script the name of the document field on which to perform this aggregation - * - * @return static + * @return $this */ public function setInitScript($script) { @@ -62,8 +60,7 @@ public function setInitScript($script) * Set the field for this aggregation * * @param string $script the name of the document field on which to perform this aggregation - * - * @return static + * @return $this */ public function setMapScript($script) { @@ -74,12 +71,10 @@ public function setMapScript($script) * Set the field for this aggregation * * @param string $script the name of the document field on which to perform this aggregation - * - * @return static + * @return $this */ public function setReduceScript($script) { return $this->setParam('reduce_script', $script); } - } diff --git a/lib/Elastica/Aggregation/Terms.php b/lib/Elastica/Aggregation/Terms.php index b45f72a6af..9fc7ab46bc 100644 --- a/lib/Elastica/Aggregation/Terms.php +++ b/lib/Elastica/Aggregation/Terms.php @@ -13,7 +13,7 @@ class Terms extends AbstractSimpleAggregation * Set the bucket sort order * @param string $order "_count", "_term", or the name of a sub-aggregation or sub-aggregation response field * @param string $direction "asc" or "desc" - * @return Terms + * @return $this */ public function setOrder($order, $direction) { @@ -23,7 +23,7 @@ public function setOrder($order, $direction) /** * Set the minimum number of documents in which a term must appear in order to be returned in a bucket * @param int $count - * @return Terms + * @return $this */ public function setMinimumDocumentCount($count) { @@ -34,7 +34,7 @@ public function setMinimumDocumentCount($count) * Filter documents to include based on a regular expression * @param string $pattern a regular expression * @param string $flags Java Pattern flags - * @return Terms + * @return $this */ public function setInclude($pattern, $flags = null) { @@ -52,7 +52,7 @@ public function setInclude($pattern, $flags = null) * Filter documents to exclude based on a regular expression * @param string $pattern a regular expression * @param string $flags Java Pattern flags - * @return Terms + * @return $this */ public function setExclude($pattern, $flags = null) { @@ -68,8 +68,8 @@ public function setExclude($pattern, $flags = null) /** * Sets the amount of terms to be returned. - * @param int $size The amount of terms to be returned. - * @return \Elastica\Aggregation\Terms + * @param int $size The amount of terms to be returned. + * @return $this */ public function setSize($size) { @@ -78,8 +78,8 @@ public function setSize($size) /** * Sets how many terms the coordinating node will request from each shard. - * @param int $shard_size The amount of terms to be returned. - * @return \Elastica\Aggregation\Terms + * @param int $shard_size The amount of terms to be returned. + * @return $this */ public function setShardSize($shard_size) { @@ -90,7 +90,7 @@ public function setShardSize($shard_size) * Instruct Elasticsearch to use direct field data or ordinals of the field values to execute this aggregation. * The execution hint will be ignored if it is not applicable. * @param string $hint map or ordinals - * @return Terms + * @return $this */ public function setExecutionHint($hint) { diff --git a/lib/Elastica/Aggregation/TopHits.php b/lib/Elastica/Aggregation/TopHits.php index c6b3a62b97..f78e01c33b 100644 --- a/lib/Elastica/Aggregation/TopHits.php +++ b/lib/Elastica/Aggregation/TopHits.php @@ -30,8 +30,8 @@ public function toArray() /** * The maximum number of top matching hits to return per bucket. By default the top three matching hits are returned. * - * @param int $size - * @return self + * @param int $size + * @return $this */ public function setSize($size) { @@ -41,8 +41,8 @@ public function setSize($size) /** * The offset from the first result you want to fetch. * - * @param int $from - * @return self + * @param int $from + * @return $this */ public function setFrom($from) { @@ -53,7 +53,7 @@ public function setFrom($from) * How the top matching hits should be sorted. By default the hits are sorted by the score of the main query. * * @param array $sortArgs - * @return self + * @return $this */ public function setSort(array $sortArgs) { @@ -64,7 +64,7 @@ public function setSort(array $sortArgs) * Allows to control how the _source field is returned with every hit. * * @param array $fields - * @return self + * @return $this */ public function setSource(array $fields) { @@ -74,8 +74,8 @@ public function setSource(array $fields) /** * Returns a version for each search hit. * - * @param bool $version - * @return self + * @param bool $version + * @return $this */ public function setVersion($version) { @@ -85,8 +85,8 @@ public function setVersion($version) /** * Enables explanation for each hit on how its score was computed. * - * @param bool $explain - * @return self + * @param bool $explain + * @return $this */ public function setExplain($explain) { @@ -97,7 +97,7 @@ public function setExplain($explain) * Set script fields * * @param array|\Elastica\ScriptFields $scriptFields - * @return self + * @return $this */ public function setScriptFields($scriptFields) { @@ -113,7 +113,7 @@ public function setScriptFields($scriptFields) * * @param string $name * @param \Elastica\Script $script - * @return self + * @return $this */ public function addScriptField($name, Script $script) { @@ -126,7 +126,7 @@ public function addScriptField($name, Script $script) * Sets highlight arguments for the results * * @param array $highlightArgs - * @return self + * @return $this */ public function setHighlight(array $highlightArgs) { @@ -137,7 +137,7 @@ public function setHighlight(array $highlightArgs) * Allows to return the field data representation of a field for each hit * * @param array $fields - * @return self + * @return $this */ public function setFieldDataFields(array $fields) { diff --git a/lib/Elastica/Aggregation/ValueCount.php b/lib/Elastica/Aggregation/ValueCount.php index 977896db31..ef3498d6ca 100644 --- a/lib/Elastica/Aggregation/ValueCount.php +++ b/lib/Elastica/Aggregation/ValueCount.php @@ -21,8 +21,8 @@ public function __construct($name, $field) /** * Set the field for this aggregation - * @param string $field the name of the document field on which to perform this aggregation - * @return ValueCount + * @param string $field the name of the document field on which to perform this aggregation + * @return $this */ public function setField($field) { diff --git a/lib/Elastica/Bulk.php b/lib/Elastica/Bulk.php index 236b13fc18..45a4136716 100644 --- a/lib/Elastica/Bulk.php +++ b/lib/Elastica/Bulk.php @@ -52,7 +52,7 @@ public function __construct(Client $client) /** * @param string|\Elastica\Index $index - * @return \Elastica\Bulk + * @return $this */ public function setIndex($index) { @@ -83,7 +83,7 @@ public function hasIndex() /** * @param string|\Elastica\Type $type - * @return \Elastica\Bulk + * @return $this */ public function setType($type) { @@ -132,7 +132,7 @@ public function getPath() /** * @param \Elastica\Bulk\Action $action - * @return \Elastica\Bulk + * @return $this */ public function addAction(Action $action) { @@ -143,7 +143,7 @@ public function addAction(Action $action) /** * @param \Elastica\Bulk\Action[] $actions - * @return \Elastica\Bulk + * @return $this */ public function addActions(array $actions) { @@ -165,7 +165,7 @@ public function getActions() /** * @param \Elastica\Document $document * @param string $opType - * @return \Elastica\Bulk + * @return $this */ public function addDocument(Document $document, $opType = null) { @@ -177,7 +177,7 @@ public function addDocument(Document $document, $opType = null) /** * @param \Elastica\Document[] $documents * @param string $opType - * @return \Elastica\Bulk + * @return $this */ public function addDocuments(array $documents, $opType = null) { @@ -191,7 +191,7 @@ public function addDocuments(array $documents, $opType = null) /** * @param \Elastica\Script $data * @param string $opType - * @return \Elastica\Bulk + * @return $this */ public function addScript(Script $script, $opType = null) { @@ -203,7 +203,7 @@ public function addScript(Script $script, $opType = null) /** * @param \Elastica\Document[] $scripts * @param string $opType - * @return \Elastica\Bulk + * @return $this */ public function addScripts(array $scripts, $opType = null) { @@ -217,7 +217,7 @@ public function addScripts(array $scripts, $opType = null) /** * @param \Elastica\Script|\Elastica\Document\array $data * @param string $opType - * @return \Elastica\Bulk + * @return $this */ public function addData($data, $opType = null) { @@ -239,9 +239,10 @@ public function addData($data, $opType = null) } /** - * @param array $data - * @return \Elastica\Bulk * @throws \Elastica\Exception\InvalidException + * + * @param array $data + * @return $this */ public function addRawData(array $data) { @@ -277,22 +278,26 @@ public function addRawData(array $data) /** * Set a url parameter on the request bulk request. - * @var string $name name of the parameter - * @var string $value value of the parameter + * @param string $name name of the parameter + * @param string $value value of the parameter + * @return $this */ public function setRequestParam($name, $value) { - $this->_requestParams[ $name ] = $value; + $this->_requestParams[$name] = $value; + + return $this; } /** * Set the amount of time that the request will wait the shards to come on line. * Requires Elasticsearch version >= 0.90.8. - * @var string $time timeout in Elasticsearch time format + * @param string $time timeout in Elasticsearch time format + * @return $this */ public function setShardTimeout($time) { - $this->setRequestParam('timeout', $time); + return $this->setRequestParam('timeout', $time); } /** @@ -345,9 +350,10 @@ public function send() } /** - * @param \Elastica\Response $response - * @throws Exception\Bulk\ResponseException - * @throws Exception\InvalidException + * @throws \Elastica\Exception\Bulk\ResponseException + * @throws \Elastica\Exception\InvalidException + * + * @param \Elastica\Response $response * @return \Elastica\Bulk\ResponseSet */ protected function _processResponse(Response $response) @@ -397,9 +403,10 @@ protected function _processResponse(Response $response) } /** - * @param string $host - * @param int $port * @throws \Elastica\Exception\Bulk\UdpException + * + * @param string $host + * @param int $port */ public function sendUdp($host = null, $port = null) { diff --git a/lib/Elastica/Bulk/Action.php b/lib/Elastica/Bulk/Action.php index dfcb3be326..fd5d456a69 100644 --- a/lib/Elastica/Bulk/Action.php +++ b/lib/Elastica/Bulk/Action.php @@ -52,8 +52,8 @@ public function __construct($opType = self::OP_TYPE_INDEX, array $metadata = arr } /** - * @param string $type - * @return \Elastica\Bulk\Action + * @param string $type + * @return $this */ public function setOpType($type) { @@ -71,8 +71,8 @@ public function getOpType() } /** - * @param array $metadata - * @return \Elastica\Bulk\Action + * @param array $metadata + * @return $this */ public function setMetadata(array $metadata) { @@ -98,8 +98,8 @@ public function getActionMetadata() } /** - * @param array $source - * @return \Elastica\Bulk\Action + * @param array $source + * @return $this */ public function setSource($source) { @@ -126,7 +126,7 @@ public function hasSource() /** * @param string|\Elastica\Index $index - * @return \Elastica\Bulk\Action + * @return $this */ public function setIndex($index) { @@ -140,7 +140,7 @@ public function setIndex($index) /** * @param string|\Elastica\Type $type - * @return \Elastica\Bulk\Action + * @return $this */ public function setType($type) { @@ -154,8 +154,8 @@ public function setType($type) } /** - * @param string $id - * @return \Elastica\Bulk\Action + * @param string $id + * @return $this */ public function setId($id) { @@ -165,8 +165,8 @@ public function setId($id) } /** - * @param string $routing - * @return \Elastica\Bulk\Action + * @param string $routing + * @return $this */ public function setRouting($routing) { diff --git a/lib/Elastica/Bulk/Action/AbstractDocument.php b/lib/Elastica/Bulk/Action/AbstractDocument.php index 8947632a9b..60ae38b851 100644 --- a/lib/Elastica/Bulk/Action/AbstractDocument.php +++ b/lib/Elastica/Bulk/Action/AbstractDocument.php @@ -23,8 +23,8 @@ public function __construct($document) } /** - * @param \Elastica\Document $document - * @return \Elastica\Bulk\Action\AbstractDocument + * @param \Elastica\Document $document + * @return $this */ public function setDocument(Document $document) { @@ -38,8 +38,8 @@ public function setDocument(Document $document) } /** - * @param \Elastica\Script $script - * @return \Elastica\Bulk\Action\AbstractDocument + * @param \Elastica\Script $script + * @return $this */ public function setScript(Script $script) { @@ -56,9 +56,10 @@ public function setScript(Script $script) } /** - * @param \Elastica\Script|\Elastica\Document $data * @throws \InvalidArgumentException - * @return \Elastica\Bulk\Action\AbstractDocument + * + * @param \Elastica\Script|\Elastica\Document $data + * @return $this */ public function setData($data) { @@ -75,7 +76,7 @@ public function setData($data) /** * Note: This is for backwards compatibility. - * @return \Elastica\Document + * @return \Elastica\Document|null */ public function getDocument() { @@ -88,7 +89,7 @@ public function getDocument() /** * Note: This is for backwards compatibility. - * @return \Elastica\Script + * @return \Elastica\Script|null */ public function getScript() { @@ -114,9 +115,9 @@ public function getData() abstract protected function _getMetadata(AbstractUpdateAction $source); /** - * @param \Elastica\Document|\Elastica\Script $data - * @param string $opType - * @return \Elastica\Bulk\Action\AbstractDocument + * @param \Elastica\Document|\Elastica\Script $data + * @param string $opType + * @return static */ public static function create($data, $opType = null) { diff --git a/lib/Elastica/Bulk/Action/IndexDocument.php b/lib/Elastica/Bulk/Action/IndexDocument.php index dc1763189c..1a85bb1938 100644 --- a/lib/Elastica/Bulk/Action/IndexDocument.php +++ b/lib/Elastica/Bulk/Action/IndexDocument.php @@ -14,8 +14,8 @@ class IndexDocument extends AbstractDocument protected $_opType = self::OP_TYPE_INDEX; /** - * @param \Elastica\Document $document - * @return \Elastica\Bulk\Action\IndexDocument + * @param \Elastica\Document $document + * @return $this */ public function setDocument(Document $document) { @@ -45,6 +45,7 @@ protected function _getMetadata(AbstractUpdateAction $action) 'timestamp', 'retry_on_conflict', ); + $metadata = $action->getOptions($params, true); return $metadata; diff --git a/lib/Elastica/Bulk/Action/UpdateDocument.php b/lib/Elastica/Bulk/Action/UpdateDocument.php index f9ea341eb0..7246e05cff 100644 --- a/lib/Elastica/Bulk/Action/UpdateDocument.php +++ b/lib/Elastica/Bulk/Action/UpdateDocument.php @@ -18,8 +18,8 @@ class UpdateDocument extends IndexDocument /** * Set the document for this bulk update action. - * @param \Elastica\Document $document - * @return \Elastica\Bulk\Action\UpdateDocument + * @param \Elastica\Document $document + * @return $this */ public function setDocument(Document $document) { @@ -43,8 +43,8 @@ public function setDocument(Document $document) } /** - * @param \Elastica\Script $script - * @return \Elastica\Bulk\Action\AbstractDocument + * @param \Elastica\Script $script + * @return $this */ public function setScript(Script $script) { diff --git a/lib/Elastica/Client.php b/lib/Elastica/Client.php index a1b4483c2d..21a3e9ae74 100644 --- a/lib/Elastica/Client.php +++ b/lib/Elastica/Client.php @@ -137,8 +137,8 @@ protected function _prepareConnectionParams(array $config) /** * Sets specific config values (updates and keeps default values) * - * @param array $config Params - * @return \Elastica\Client + * @param array $config Params + * @return $this */ public function setConfig(array $config) { @@ -153,9 +153,10 @@ public function setConfig(array $config) * Returns a specific config key or the whole * config array if not set * - * @param string $key Config key * @throws \Elastica\Exception\InvalidException - * @return array|string Config value + * + * @param string $key Config key + * @return array|string Config value */ public function getConfig($key = '') { @@ -173,9 +174,9 @@ public function getConfig($key = '') /** * Sets / overwrites a specific config value * - * @param string $key Key to set - * @param mixed $value Value - * @return \Elastica\Client Client object + * @param string $key Key to set + * @param mixed $value Value + * @return $this */ public function setConfigValue($key, $value) { @@ -215,9 +216,11 @@ public function getIndex($name) /** * Adds a HTTP Header * - * @param string $header The HTTP Header - * @param string $headerValue The HTTP Header Value * @throws \Elastica\Exception\InvalidException If $header or $headerValue is not a string + * + * @param string $header The HTTP Header + * @param string $headerValue The HTTP Header Value + * @return $this */ public function addHeader($header, $headerValue) { @@ -226,13 +229,17 @@ public function addHeader($header, $headerValue) } else { throw new InvalidException('Header must be a string'); } + + return $this; } /** * Remove a HTTP Header * - * @param string $header The HTTP Header to remove - * @throws \Elastica\Exception\InvalidException IF $header is not a string + * @throws \Elastica\Exception\InvalidException If $header is not a string + * + * @param string $header The HTTP Header to remove + * @return $this */ public function removeHeader($header) { @@ -243,6 +250,8 @@ public function removeHeader($header) } else { throw new InvalidException('Header must be a string'); } + + return $this; } /** @@ -252,10 +261,11 @@ public function removeHeader($header) * set inside the document, because for bulk settings documents, * documents can belong to any type and index * - * @param array|\Elastica\Document[] $docs Array of Elastica\Document - * @return \Elastica\Bulk\ResponseSet Response object * @throws \Elastica\Exception\InvalidException If docs is empty * @link http://www.elasticsearch.org/guide/reference/api/bulk.html + * + * @param array|\Elastica\Document[] $docs Array of Elastica\Document + * @return \Elastica\Bulk\ResponseSet Response object */ public function updateDocuments(array $docs) { @@ -277,10 +287,11 @@ public function updateDocuments(array $docs) * set inside the document, because for bulk settings documents, * documents can belong to any type and index * - * @param array|\Elastica\Document[] $docs Array of Elastica\Document - * @return \Elastica\Bulk\ResponseSet Response object * @throws \Elastica\Exception\InvalidException If docs is empty * @link http://www.elasticsearch.org/guide/reference/api/bulk.html + * + * @param array|\Elastica\Document[] $docs Array of Elastica\Document + * @return \Elastica\Bulk\ResponseSet Response object */ public function addDocuments(array $docs) { @@ -405,9 +416,10 @@ protected function _populateDocumentFieldsFromResponse(Response $response, Docum /** * Bulk deletes documents * - * @param array|\Elastica\Document[] $docs - * @return \Elastica\Bulk\ResponseSet * @throws \Elastica\Exception\InvalidException + * + * @param array|\Elastica\Document[] $docs + * @return \Elastica\Bulk\ResponseSet */ public function deleteDocuments(array $docs) { @@ -443,7 +455,7 @@ public function getCluster() /** * @param \Elastica\Connection $connection - * @return \Elastica\Client + * @return $this */ public function addConnection(Connection $connection) { @@ -464,6 +476,7 @@ public function hasConnection() /** * @throws \Elastica\Exception\ClientException + * * @return \Elastica\Connection */ public function getConnection() @@ -489,7 +502,7 @@ public function getConnectionStrategy() /** * @param array|\Elastica\Connection[] $connections - * @return \Elastica\Client + * @return $this */ public function setConnections(array $connections) { @@ -501,13 +514,14 @@ public function setConnections(array $connections) /** * Deletes documents with the given ids, index, type from the index * - * @param array $ids Document ids - * @param string|\Elastica\Index $index Index name - * @param string|\Elastica\Type $type Type of documents - * @param string|false $routing Optional routing key for all ids * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Bulk\ResponseSet Response object * @link http://www.elasticsearch.org/guide/reference/api/bulk.html + * + * @param array $ids Document ids + * @param string|\Elastica\Index $index Index name + * @param string|\Elastica\Type $type Type of documents + * @param string|false $routing Optional routing key for all ids + * @return \Elastica\Bulk\ResponseSet Response object */ public function deleteIds(array $ids, $index, $type, $routing = false) { @@ -545,11 +559,12 @@ public function deleteIds(array $ids, $index, $type, $routing = false) * array('delete' => array('_index' => 'test', '_type' => 'user', '_id' => '2')) * ); * - * @param array $params Parameter array * @throws \Elastica\Exception\ResponseException * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Bulk\ResponseSet Response object * @link http://www.elasticsearch.org/guide/reference/api/bulk.html + * + * @param array $params Parameter array + * @return \Elastica\Bulk\ResponseSet Response object */ public function bulk(array $params) { @@ -569,12 +584,13 @@ public function bulk(array $params) * * It's possible to make any REST query directly over this method * - * @param string $path Path to call - * @param string $method Rest method to use (GET, POST, DELETE, PUT) - * @param array $data OPTIONAL Arguments as array - * @param array $query OPTIONAL Query params * @throws Exception\ConnectionException|\Exception - * @return \Elastica\Response Response object + * + * @param string $path Path to call + * @param string $method Rest method to use (GET, POST, DELETE, PUT) + * @param array $data OPTIONAL Arguments as array + * @param array $query OPTIONAL Query params + * @return \Elastica\Response Response object */ public function request($path, $method = Request::GET, $data = array(), array $query = array()) { @@ -628,8 +644,9 @@ public function refreshAll() /** * logging * - * @param string|\Elastica\Request $context * @throws Exception\RuntimeException + * + * @param string|\Elastica\Request $context */ protected function _log($context) { diff --git a/lib/Elastica/Cluster.php b/lib/Elastica/Cluster.php index 3e55f38044..29e57ab799 100644 --- a/lib/Elastica/Cluster.php +++ b/lib/Elastica/Cluster.php @@ -140,9 +140,10 @@ public function getClient() /** * Returns the cluster information (not implemented yet) * - * @param array $args Additional arguments * @throws \Elastica\Exception\NotImplementedException * @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-info.html + * + * @param array $args Additional arguments */ public function getInfo(array $args) { @@ -152,8 +153,9 @@ public function getInfo(array $args) /** * Return Cluster health * - * @return \Elastica\Cluster\Health * @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html + * + * @return \Elastica\Cluster\Health */ public function getHealth() { @@ -173,9 +175,10 @@ public function getSettings() /** * Shuts down the complete cluster * + * @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html + * * @param string $delay OPTIONAL Seconds to shutdown cluster after (default = 1s) * @return \Elastica\Response - * @link http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html */ public function shutdown($delay = '1s') { diff --git a/lib/Elastica/Cluster/Health.php b/lib/Elastica/Cluster/Health.php index a73bf0f32b..dc93a52a2b 100644 --- a/lib/Elastica/Cluster/Health.php +++ b/lib/Elastica/Cluster/Health.php @@ -16,16 +16,12 @@ class Health { /** - * Elastica client. - * - * @var \Elastica\Client Client object + * @var \Elastica\Client Client object. */ protected $_client = null; /** - * The cluster health data. - * - * @var array + * @var array The cluster health data. */ protected $_data = null; @@ -64,7 +60,7 @@ public function getData() /** * Refreshes the health data for the cluster. * - * @return \Elastica\Cluster\Health + * @return $this */ public function refresh() { diff --git a/lib/Elastica/Cluster/Health/Index.php b/lib/Elastica/Cluster/Health/Index.php index c39e94c36f..0be8b075ec 100644 --- a/lib/Elastica/Cluster/Health/Index.php +++ b/lib/Elastica/Cluster/Health/Index.php @@ -12,16 +12,12 @@ class Index { /** - * The name of the index. - * - * @var string + * @var string The name of the index. */ protected $_name; /** - * The index health data. - * - * @var array + * @var array The index health data. */ protected $_data; diff --git a/lib/Elastica/Cluster/Health/Shard.php b/lib/Elastica/Cluster/Health/Shard.php index a5da08ae72..f50025f444 100644 --- a/lib/Elastica/Cluster/Health/Shard.php +++ b/lib/Elastica/Cluster/Health/Shard.php @@ -12,16 +12,12 @@ class Shard { /** - * The shard index/number. - * - * @var int + * @var int The shard index/number. */ protected $_shardNumber; /** - * The shard health data. - * - * @var array + * @var array The shard health data. */ protected $_data; diff --git a/lib/Elastica/Cluster/Settings.php b/lib/Elastica/Cluster/Settings.php index 22934dddcc..c12a442667 100644 --- a/lib/Elastica/Cluster/Settings.php +++ b/lib/Elastica/Cluster/Settings.php @@ -16,8 +16,6 @@ class Settings { /** - * Client - * * @var \Elastica\Client Client object */ protected $_client = null; diff --git a/lib/Elastica/Connection.php b/lib/Elastica/Connection.php index 739cea46f1..a506d4195d 100644 --- a/lib/Elastica/Connection.php +++ b/lib/Elastica/Connection.php @@ -62,8 +62,8 @@ public function getPort() } /** - * @param int $port - * @return \Elastica\Connection + * @param int $port + * @return $this */ public function setPort($port) { @@ -79,8 +79,8 @@ public function getHost() } /** - * @param string $host - * @return \Elastica\Connection + * @param string $host + * @return $this */ public function setHost($host) { @@ -100,8 +100,8 @@ public function getProxy() * empty string to disable proxy and proxy string to set actual http proxy. * * @see http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY - * @param string|null $proxy - * @return \Elastica\Connection + * @param string|null $proxy + * @return $this */ public function setProxy($proxy) { @@ -117,8 +117,8 @@ public function getTransport() } /** - * @param string|array $transport - * @return \Elastica\Connection + * @param string|array $transport + * @return $this */ public function setTransport($transport) { @@ -134,8 +134,8 @@ public function getPath() } /** - * @param string $path - * @return \Elastica\Connection + * @param string $path + * @return $this */ public function setPath($path) { @@ -143,8 +143,8 @@ public function setPath($path) } /** - * @param int $timeout Timeout in seconds - * @return \Elastica\Connection + * @param int $timeout Timeout in seconds + * @return $this */ public function setTimeout($timeout) { @@ -162,8 +162,8 @@ public function getTimeout() /** * Enables a connection * - * @param bool $enabled OPTIONAL (default = true) - * @return \Elastica\Connection + * @param bool $enabled OPTIONAL (default = true) + * @return $this */ public function setEnabled($enabled = true) { @@ -181,8 +181,9 @@ public function isEnabled() /** * Returns an instance of the transport type * + * @throws \Elastica\Exception\InvalidException If invalid transport type + * * @return \Elastica\Transport\AbstractTransport Transport object - * @throws \Elastica\Exception\InvalidException If invalid transport type */ public function getTransportObject() { @@ -200,8 +201,8 @@ public function isPersistent() } /** - * @param array $config - * @return \Elastica\Connection + * @param array $config + * @return $this */ public function setConfig(array $config) { @@ -209,9 +210,9 @@ public function setConfig(array $config) } /** - * @param string $key - * @param mixed $value - * @return \Elastica\Connection + * @param string $key + * @param mixed $value + * @return $this */ public function addConfig($key, $value) { @@ -235,9 +236,10 @@ public function hasConfig($key) * Returns a specific config key or the whole * config array if not set * - * @param string $key Config key * @throws \Elastica\Exception\InvalidException - * @return array|string Config value + * + * @param string $key Config key + * @return array|string Config value */ public function getConfig($key = '') { @@ -254,9 +256,10 @@ public function getConfig($key = '') } /** - * @param \Elastica\Connection|array $params Params to create a connection * @throws Exception\InvalidException - * @return \Elastica\Connection + * + * @param \Elastica\Connection|array $params Params to create a connection + * @return self */ public static function create($params = array()) { diff --git a/lib/Elastica/Connection/ConnectionPool.php b/lib/Elastica/Connection/ConnectionPool.php index 058fe34d22..04cd6e7eea 100644 --- a/lib/Elastica/Connection/ConnectionPool.php +++ b/lib/Elastica/Connection/ConnectionPool.php @@ -15,23 +15,17 @@ class ConnectionPool { /** - * Connections array - * - * @var array|\Elastica\Connection[] + * @var array|\Elastica\Connection[] Connections array */ protected $_connections; /** - * Strategy for connection - * - * @var \Elastica\Connection\Strategy\StrategyInterface + * @var \Elastica\Connection\Strategy\StrategyInterface Strategy for connection */ protected $_strategy; /** - * Callback function called on connection fail - * - * @var callback + * @var callback Function called on connection fail */ protected $_callback; @@ -50,19 +44,25 @@ public function __construct(array $connections, StrategyInterface $strategy, $ca } /** - * @param \Elastica\Connection $connection + * @param \Elastica\Connection $connection + * @return $this */ public function addConnection(Connection $connection) { $this->_connections[] = $connection; + + return $this; } /** - * @param array|\Elastica\Connection[] $connections + * @param array|\Elastica\Connection[] $connections + * @return $this */ public function setConnections(array $connections) { $this->_connections = $connections; + + return $this; } /** @@ -88,8 +88,9 @@ public function getConnections() } /** - * @return \Elastica\Connection * @throws \Elastica\Exception\ClientException + * + * @return \Elastica\Connection */ public function getConnection() { @@ -111,7 +112,6 @@ public function onFail(Connection $connection, Exception $e, Client $client) } /** - * * @return \Elastica\Connection\Strategy\StrategyInterface */ public function getStrategy() diff --git a/lib/Elastica/Connection/Strategy/RoundRobin.php b/lib/Elastica/Connection/Strategy/RoundRobin.php index ea781efc7f..f9aa9ded44 100644 --- a/lib/Elastica/Connection/Strategy/RoundRobin.php +++ b/lib/Elastica/Connection/Strategy/RoundRobin.php @@ -10,9 +10,10 @@ class RoundRobin extends Simple { /** - * @param array|\Elastica\Connection[] $connections - * @return \Elastica\Connection * @throws \Elastica\Exception\ClientException + * + * @param array|\Elastica\Connection[] $connections + * @return \Elastica\Connection */ public function getConnection($connections) { diff --git a/lib/Elastica/Connection/Strategy/Simple.php b/lib/Elastica/Connection/Strategy/Simple.php index 9b2f0687d3..e68e489ec6 100644 --- a/lib/Elastica/Connection/Strategy/Simple.php +++ b/lib/Elastica/Connection/Strategy/Simple.php @@ -12,9 +12,10 @@ class Simple implements StrategyInterface { /** - * @param array|\Elastica\Connection[] $connections - * @return \Elastica\Connection * @throws \Elastica\Exception\ClientException + * + * @param array|\Elastica\Connection[] $connections + * @return \Elastica\Connection */ public function getConnection($connections) { diff --git a/lib/Elastica/Connection/Strategy/StrategyFactory.php b/lib/Elastica/Connection/Strategy/StrategyFactory.php index 29248c25af..8310616167 100644 --- a/lib/Elastica/Connection/Strategy/StrategyFactory.php +++ b/lib/Elastica/Connection/Strategy/StrategyFactory.php @@ -12,9 +12,10 @@ class StrategyFactory { /** + * @throws \Elastica\Exception\InvalidException + * * @param mixed|Closure|String|StrategyInterface $strategyName * @return \Elastica\Connection\Strategy\StrategyInterface - * @throws \Elastica\Exception\InvalidException */ public static function create($strategyName) { diff --git a/lib/Elastica/Document.php b/lib/Elastica/Document.php index 04c6346c42..91590e7f78 100644 --- a/lib/Elastica/Document.php +++ b/lib/Elastica/Document.php @@ -89,9 +89,10 @@ public function __unset($key) } /** - * @param string $key - * @return mixed * @throws \Elastica\Exception\InvalidException + * + * @param string $key + * @return mixed */ public function get($key) { @@ -103,10 +104,11 @@ public function get($key) } /** - * @param string $key - * @param mixed $value * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Document + * + * @param string $key + * @param mixed $value + * @return $this */ public function set($key, $value) { @@ -128,9 +130,10 @@ public function has($key) } /** - * @param string $key * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Document + * + * @param string $key + * @return $this */ public function remove($key) { @@ -146,9 +149,9 @@ public function remove($key) * Adds the given key/value pair to the document * * @deprecated - * @param string $key Document entry key - * @param mixed $value Document entry value - * @return \Elastica\Document + * @param string $key Document entry key + * @param mixed $value Document entry value + * @return $this */ public function add($key, $value) { @@ -166,10 +169,10 @@ public function add($key, $value) * This installs the tika file analysis plugin. More infos about supported formats * can be found here: {@link http://tika.apache.org/0.7/formats.html} * - * @param string $key Key to add the file to - * @param string $filepath Path to add the file - * @param string $mimeType OPTIONAL Header mime type - * @return \Elastica\Document + * @param string $key Key to add the file to + * @param string $filepath Path to add the file + * @param string $mimeType OPTIONAL Header mime type + * @return $this */ public function addFile($key, $filepath, $mimeType = '') { @@ -187,9 +190,9 @@ public function addFile($key, $filepath, $mimeType = '') /** * Add file content * - * @param string $key Document key - * @param string $content Raw file content - * @return \Elastica\Document + * @param string $key Document key + * @param string $content Raw file content + * @return $this */ public function addFileContent($key, $content) { @@ -201,11 +204,11 @@ public function addFileContent($key, $content) * * Geohashes are not yet supported * - * @param string $key Field key - * @param float $latitude Latitude value - * @param float $longitude Longitude value + * @param string $key Field key + * @param float $latitude Latitude value + * @param float $longitude Longitude value * @link http://www.elasticsearch.org/guide/reference/mapping/geo-point-type.html - * @return \Elastica\Document + * @return $this */ public function addGeoPoint($key, $latitude, $longitude) { @@ -219,8 +222,8 @@ public function addGeoPoint($key, $latitude, $longitude) /** * Overwrites the current document data with the given data * - * @param array|string $data Data array - * @return \Elastica\Document + * @param array|string $data Data array + * @return $this */ public function setData($data) { @@ -240,9 +243,10 @@ public function getData() } /** - * @param \Elastica\Script $data * @throws NotImplementedException * @deprecated + * + * @param \Elastica\Script $data */ public function setScript($data) { @@ -268,8 +272,8 @@ public function hasScript() } /** - * @param bool $value - * @return \Elastica\Document + * @param bool $value + * @return $this */ public function setDocAsUpsert($value) { @@ -318,9 +322,10 @@ public function toArray() } /** - * @param array|\Elastica\Document $data * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Document + * + * @param array|\Elastica\Document $data + * @return self */ public static function create($data) { diff --git a/lib/Elastica/Exception/Bulk/ResponseException.php b/lib/Elastica/Exception/Bulk/ResponseException.php index 02ed7ae346..3f952aef42 100644 --- a/lib/Elastica/Exception/Bulk/ResponseException.php +++ b/lib/Elastica/Exception/Bulk/ResponseException.php @@ -15,8 +15,6 @@ class ResponseException extends BulkException { /** - * Response - * * @var \Elastica\Bulk\ResponseSet ResponseSet object */ protected $_responseSet; diff --git a/lib/Elastica/Exception/ConnectionException.php b/lib/Elastica/Exception/ConnectionException.php index f6c76eba27..4d21aa7994 100644 --- a/lib/Elastica/Exception/ConnectionException.php +++ b/lib/Elastica/Exception/ConnectionException.php @@ -15,15 +15,11 @@ class ConnectionException extends \RuntimeException implements ExceptionInterface { /** - * Request - * * @var \Elastica\Request Request object */ protected $_request; /** - * Response - * * @var \Elastica\Response Response object */ protected $_response; diff --git a/lib/Elastica/Exception/ElasticsearchException.php b/lib/Elastica/Exception/ElasticsearchException.php index 3cc809c431..f312eae08e 100644 --- a/lib/Elastica/Exception/ElasticsearchException.php +++ b/lib/Elastica/Exception/ElasticsearchException.php @@ -14,16 +14,12 @@ class ElasticsearchException extends \Exception implements ExceptionInterface const REMOTE_TRANSPORT_EXCEPTION = 'RemoteTransportException'; /** - * Elasticsearch exception name - * - * @var string|null + * @var string|null Elasticsearch exception name */ private $_exception; /** - * Whether exception was local to server node or remote - * - * @var bool + * @var bool Whether exception was local to server node or remote */ private $_isRemote = false; diff --git a/lib/Elastica/Exception/ResponseException.php b/lib/Elastica/Exception/ResponseException.php index b5b80fded0..5c7483baf7 100644 --- a/lib/Elastica/Exception/ResponseException.php +++ b/lib/Elastica/Exception/ResponseException.php @@ -15,15 +15,11 @@ class ResponseException extends \RuntimeException implements ExceptionInterface { /** - * Request - * * @var \Elastica\Request Request object */ protected $_request = null; /** - * Response - * * @var \Elastica\Response Response object */ protected $_response = null; diff --git a/lib/Elastica/Facet/AbstractFacet.php b/lib/Elastica/Facet/AbstractFacet.php index bc6021a1af..7914b36ed2 100644 --- a/lib/Elastica/Facet/AbstractFacet.php +++ b/lib/Elastica/Facet/AbstractFacet.php @@ -17,14 +17,12 @@ abstract class AbstractFacet extends Param { /** - * Holds the name of the facet. - * @var string + * @var string Holds the name of the facet. */ protected $_name = ''; /** - * Holds all facet parameters. - * @var array + * @var array Holds all facet parameters. */ protected $_facet = array(); @@ -42,9 +40,10 @@ public function __construct($name) * Sets the name of the facet. It is automatically set by * the constructor. * - * @param string $name The name of the facet. - * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Facet\AbstractFacet + * @throws \Elastica\Exception\InvalidException If name is empty + * + * @param string $name The name of the facet. + * @return $this */ public function setName($name) { @@ -70,7 +69,7 @@ public function getName() * Sets a filter for this facet. * * @param \Elastica\Filter\AbstractFilter $filter A filter to apply on the facet. - * @return \Elastica\Facet\AbstractFacet + * @return $this */ public function setFilter(AbstractFilter $filter) { @@ -82,8 +81,8 @@ public function setFilter(AbstractFilter $filter) * current search query. When not set, it defaults to the * Elasticsearch default value. * - * @param bool $global Flag to either run the facet globally. - * @return \Elastica\Facet\AbstractFacet + * @param bool $global Flag to either run the facet globally. + * @return $this */ public function setGlobal($global = true) { @@ -93,8 +92,8 @@ public function setGlobal($global = true) /** * Sets the path to the nested document * - * @param string $nestedPath Nested path - * @return \Elastica\Facet\AbstractFacet + * @param string $nestedPath Nested path + * @return $this */ public function setNested($nestedPath) { @@ -104,8 +103,8 @@ public function setNested($nestedPath) /** * Sets the scope * - * @param string $scope Scope - * @return \Elastica\Facet\AbstractFacet + * @param string $scope Scope + * @return $this */ public function setScope($scope) { @@ -128,9 +127,9 @@ public function toArray() * Sets a param for the facet. Each facet implementation needs to take * care of handling their own params. * - * @param string $key The key of the param to set. - * @param mixed $value The value of the param. - * @return \Elastica\Facet\AbstractFacet + * @param string $key The key of the param to set. + * @param mixed $value The value of the param. + * @return $this */ protected function _setFacetParam($key, $value) { diff --git a/lib/Elastica/Facet/DateHistogram.php b/lib/Elastica/Facet/DateHistogram.php index 205277ef2d..696d2d20ba 100644 --- a/lib/Elastica/Facet/DateHistogram.php +++ b/lib/Elastica/Facet/DateHistogram.php @@ -16,8 +16,8 @@ class DateHistogram extends Histogram /** * Set the time_zone parameter * - * @param string $tzOffset - * @return \Elastica\Facet\DateHistogram + * @param string $tzOffset + * @return $this */ public function setTimezone($tzOffset) { @@ -30,6 +30,7 @@ public function setTimezone($tzOffset) * * @see \Elastica\Facet\AbstractFacet::toArray() * @throws \Elastica\Exception\InvalidException When the right fields haven't been set. + * * @return array */ public function toArray() diff --git a/lib/Elastica/Facet/Filter.php b/lib/Elastica/Facet/Filter.php index ed6f28b778..268c92cf01 100644 --- a/lib/Elastica/Facet/Filter.php +++ b/lib/Elastica/Facet/Filter.php @@ -18,7 +18,7 @@ class Filter extends AbstractFacet * Set the filter for the facet. * * @param \Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Facet\Filter + * @return $this */ public function setFilter(AbstractFilter $filter) { diff --git a/lib/Elastica/Facet/GeoCluster.php b/lib/Elastica/Facet/GeoCluster.php index 4dad35b0b1..64abef7d6a 100644 --- a/lib/Elastica/Facet/GeoCluster.php +++ b/lib/Elastica/Facet/GeoCluster.php @@ -51,6 +51,7 @@ public function setShowIds($showIds) * * @see \Elastica\Facet\AbstractFacet::toArray() * @throws \Elastica\Exception\InvalidException When the right fields haven't been set. + * * @return array */ public function toArray() diff --git a/lib/Elastica/Facet/GeoDistance.php b/lib/Elastica/Facet/GeoDistance.php index 8ff523fed8..e0b723aa47 100644 --- a/lib/Elastica/Facet/GeoDistance.php +++ b/lib/Elastica/Facet/GeoDistance.php @@ -22,8 +22,8 @@ class GeoDistance extends AbstractFacet * array('from' => 150) * ) * - * @param array $ranges Numerical array with range definitions. - * @return \Elastica\Facet\GeoDistance + * @param array $ranges Numerical array with range definitions. + * @return $this */ public function setRanges(array $ranges) { @@ -33,10 +33,10 @@ public function setRanges(array $ranges) /** * Set the relative GeoPoint for the facet. * - * @param string $typeField index type and field e.g foo.bar - * @param float $latitude - * @param float $longitude - * @return \Elastica\Facet\GeoDistance + * @param string $typeField index type and field e.g foo.bar + * @param float $latitude + * @param float $longitude + * @return $this */ public function setGeoPoint($typeField, $latitude, $longitude) { @@ -52,6 +52,7 @@ public function setGeoPoint($typeField, $latitude, $longitude) * * @see \Elastica\Facet\AbstractFacet::toArray() * @throws \Elastica\Exception\InvalidException When the right fields haven't been set. + * * @return array */ public function toArray() diff --git a/lib/Elastica/Facet/Histogram.php b/lib/Elastica/Facet/Histogram.php index 0cef46bae9..d48ca2a969 100644 --- a/lib/Elastica/Facet/Histogram.php +++ b/lib/Elastica/Facet/Histogram.php @@ -15,8 +15,8 @@ class Histogram extends AbstractFacet /** * Sets the field for histogram * - * @param string $field The name of the field for the histogram - * @return \Elastica\Facet\Histogram + * @param string $field The name of the field for the histogram + * @return $this */ public function setField($field) { @@ -26,8 +26,8 @@ public function setField($field) /** * Set the value for interval * - * @param string $interval - * @return \Elastica\Facet\Histogram + * @param string $interval + * @return $this */ public function setInterval($interval) { @@ -37,9 +37,9 @@ public function setInterval($interval) /** * Set the fields for key_field and value_field * - * @param string $keyField Key field - * @param string $valueField Value field - * @return \Elastica\Facet\Histogram + * @param string $keyField Key field + * @param string $valueField Value field + * @return $this */ public function setKeyValueFields($keyField, $valueField) { @@ -49,9 +49,9 @@ public function setKeyValueFields($keyField, $valueField) /** * Sets the key and value for this facet by script. * - * @param string $keyScript Script to check whether it falls into the range. - * @param string $valueScript Script to use for statistical calculations. - * @return \Elastica\Facet\Histogram + * @param string $keyScript Script to check whether it falls into the range. + * @param string $valueScript Script to use for statistical calculations. + * @return $this */ public function setKeyValueScripts($keyScript, $valueScript) { @@ -62,8 +62,8 @@ public function setKeyValueScripts($keyScript, $valueScript) /** * Set the "params" essential to the a script * - * @param array $params Associative array (key/value pair) - * @return \Elastica\Facet\Histogram + * @param array $params Associative array (key/value pair) + * @return $this */ public function setScriptParams(array $params) { @@ -76,6 +76,7 @@ public function setScriptParams(array $params) * * @see \Elastica\Facet\AbstractFacet::toArray() * @throws \Elastica\Exception\InvalidException When the right fields haven't been set. + * * @return array */ public function toArray() diff --git a/lib/Elastica/Facet/Query.php b/lib/Elastica/Facet/Query.php index d43a2375df..d33b3cadbb 100644 --- a/lib/Elastica/Facet/Query.php +++ b/lib/Elastica/Facet/Query.php @@ -18,7 +18,7 @@ class Query extends AbstractFacet * Set the query for the facet. * * @param \Elastica\Query\AbstractQuery $query - * @return \Elastica\Facet\Query + * @return $this */ public function setQuery(AbstractQuery $query) { diff --git a/lib/Elastica/Facet/Range.php b/lib/Elastica/Facet/Range.php index 9d887cc677..16f5e443c4 100644 --- a/lib/Elastica/Facet/Range.php +++ b/lib/Elastica/Facet/Range.php @@ -17,8 +17,8 @@ class Range extends AbstractFacet /** * Sets the field for the range. * - * @param string $field The name of the field for range. - * @return \Elastica\Facet\Range + * @param string $field The name of the field for range. + * @return $this */ public function setField($field) { @@ -28,9 +28,9 @@ public function setField($field) /** * Sets the fields by their separate key and value fields. * - * @param string $keyField The key_field param for the range. - * @param string $valueField The key_value param for the range. - * @return \Elastica\Facet\Range + * @param string $keyField The key_field param for the range. + * @param string $valueField The key_value param for the range. + * @return $this */ public function setKeyValueFields($keyField, $valueField) { @@ -41,10 +41,9 @@ public function setKeyValueFields($keyField, $valueField) /** * Sets the key and value for this facet by script. * - * @param string $keyScript Script to check whether it falls into the range. - * @param string $valueScript Script to use for statistical calculations. - * - * @return \Elastica\Facet\Range + * @param string $keyScript Script to check whether it falls into the range. + * @param string $valueScript Script to use for statistical calculations. + * @return $this */ public function setKeyValueScripts($keyScript, $valueScript) { @@ -61,8 +60,8 @@ public function setKeyValueScripts($keyScript, $valueScript) * array('from' => 150) * ) * - * @param array $ranges Numerical array with range definitions. - * @return \Elastica\Facet\Range + * @param array $ranges Numerical array with range definitions. + * @return $this */ public function setRanges(array $ranges) { @@ -72,9 +71,9 @@ public function setRanges(array $ranges) /** * Adds a range to the range facet. * - * @param mixed $from The from for the range. - * @param mixed $to The to for the range. - * @return \Elastica\Facet\Range + * @param mixed $from The from for the range. + * @param mixed $to The to for the range. + * @return $this */ public function addRange($from = null, $to = null) { @@ -100,6 +99,7 @@ public function addRange($from = null, $to = null) * * @see \Elastica\Facet\AbstractFacet::toArray() * @throws \Elastica\Exception\InvalidException When the right fields haven't been set. + * * @return array */ public function toArray() diff --git a/lib/Elastica/Facet/Statistical.php b/lib/Elastica/Facet/Statistical.php index c3cfa3fbec..77448a0670 100644 --- a/lib/Elastica/Facet/Statistical.php +++ b/lib/Elastica/Facet/Statistical.php @@ -15,8 +15,8 @@ class Statistical extends AbstractFacet /** * Sets the field for the statistical query. * - * @param string $field The field name for the statistical query. - * @return \Elastica\Facet\Statistical + * @param string $field The field name for the statistical query. + * @return $this */ public function setField($field) { @@ -26,8 +26,8 @@ public function setField($field) /** * Sets multiple fields for the statistical query. * - * @param array $fields Numerical array with the fields for the statistical query. - * @return \Elastica\Facet\Statistical + * @param array $fields Numerical array with the fields for the statistical query. + * @return $this */ public function setFields(array $fields) { @@ -37,8 +37,8 @@ public function setFields(array $fields) /** * Sets a script to calculate statistical information * - * @param string $script The script to do calculations on the statistical values - * @return \Elastica\Facet\Statistical + * @param string $script The script to do calculations on the statistical values + * @return $this */ public function setScript($script) { diff --git a/lib/Elastica/Facet/Terms.php b/lib/Elastica/Facet/Terms.php index ee84ce716b..fce11cfa2a 100644 --- a/lib/Elastica/Facet/Terms.php +++ b/lib/Elastica/Facet/Terms.php @@ -27,8 +27,8 @@ class Terms extends AbstractFacet /** * Sets the field for the terms. * - * @param string $field The field name for the terms. - * @return \Elastica\Facet\Terms + * @param string $field The field name for the terms. + * @return $this */ public function setField($field) { @@ -38,8 +38,8 @@ public function setField($field) /** * Sets the script for the term. * - * @param string $script The script for the term. - * @return \Elastica\Facet\Terms + * @param string $script The script for the term. + * @return $this */ public function setScript($script) { @@ -54,8 +54,8 @@ public function setScript($script) /** * Sets multiple fields for the terms. * - * @param array $fields Numerical array with the fields for the terms. - * @return \Elastica\Facet\Terms + * @param array $fields Numerical array with the fields for the terms. + * @return $this */ public function setFields(array $fields) { @@ -66,8 +66,8 @@ public function setFields(array $fields) * Sets the flag to return all available terms. When they * don't have a hit, they have a count of zero. * - * @param bool $allTerms Flag to fetch all terms. - * @return \Elastica\Facet\Terms + * @param bool $allTerms Flag to fetch all terms. + * @return $this */ public function setAllTerms($allTerms) { @@ -78,9 +78,10 @@ public function setAllTerms($allTerms) * 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. * @throws \Elastica\Exception\InvalidException When an invalid order type was set. - * @return \Elastica\Facet\Terms + * + * @param string $type The order type to set use for sorting of the terms. + * @return $this */ public function setOrder($type) { @@ -94,8 +95,8 @@ public function setOrder($type) /** * Set an array with terms which are omitted in the search. * - * @param array $exclude Numerical array which includes all terms which needs to be ignored. - * @return \Elastica\Facet\Terms + * @param array $exclude Numerical array which includes all terms which needs to be ignored. + * @return $this */ public function setExclude(array $exclude) { @@ -105,8 +106,8 @@ public function setExclude(array $exclude) /** * 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) { @@ -118,6 +119,7 @@ public function setSize($size) * facet definition of the parent. * * @see \Elastica\Facet\AbstractFacet::toArray() + * * @return array */ public function toArray() diff --git a/lib/Elastica/Facet/TermsStats.php b/lib/Elastica/Facet/TermsStats.php index 16df875d3a..fa4607897a 100644 --- a/lib/Elastica/Facet/TermsStats.php +++ b/lib/Elastica/Facet/TermsStats.php @@ -27,8 +27,8 @@ class TermsStats extends AbstractFacet /** * 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) { @@ -38,8 +38,8 @@ public function setKeyField($keyField) /** * Sets a script to calculate statistical information on a per term basis * - * @param string $valueScript The script to do calculations on the statistical values - * @return \Elastica\Facet\TermsStats + * @param string $valueScript The script to do calculations on the statistical values + * @return $this */ public function setValueScript($valueScript) { @@ -50,9 +50,10 @@ public function setValueScript($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. * @throws \Elastica\Exception\InvalidException When an invalid order type was set. - * @return \Elastica\Facet\TermsStats + * + * @param string $type The order type to set use for sorting of the terms. + * @return $this */ public function setOrder($type) { @@ -66,8 +67,8 @@ public function setOrder($type) /** * Sets a field to compute basic statistical results on * - * @param string $valueField The field to compute statistical values for - * @return \Elastica\Facet\TermsStats + * @param string $valueField The field to compute statistical values for + * @return $this */ public function setValueField($valueField) { @@ -77,8 +78,8 @@ public function setValueField($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) { @@ -90,6 +91,7 @@ public function setSize($size) * facet definition of the parent. * * @see \Elastica\Facet\AbstractFacet::toArray() + * * @return array */ public function toArray() diff --git a/lib/Elastica/Filter/AbstractFilter.php b/lib/Elastica/Filter/AbstractFilter.php index 899e0ed500..e67be712fd 100644 --- a/lib/Elastica/Filter/AbstractFilter.php +++ b/lib/Elastica/Filter/AbstractFilter.php @@ -18,8 +18,8 @@ abstract class AbstractFilter extends Param /** * Sets the filter cache * - * @param boolean $cached Cached - * @return \Elastica\Filter\AbstractFilter + * @param boolean $cached Cached + * @return $this */ public function setCached($cached = true) { @@ -29,9 +29,10 @@ public function setCached($cached = true) /** * Sets the filter cache key * - * @param string $cacheKey Cache key - * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Filter\AbstractFilter + * @throws \Elastica\Exception\InvalidException If given key is empty + * + * @param string $cacheKey Cache key + * @return $this */ public function setCacheKey($cacheKey) { @@ -47,8 +48,8 @@ public function setCacheKey($cacheKey) /** * Sets the filter name * - * @param string $name Name - * @return \Elastica\Filter\AbstractFilter + * @param string $name Name + * @return $this */ public function setName($name) { diff --git a/lib/Elastica/Filter/AbstractGeoDistance.php b/lib/Elastica/Filter/AbstractGeoDistance.php index 6cb833d5d5..8849952804 100644 --- a/lib/Elastica/Filter/AbstractGeoDistance.php +++ b/lib/Elastica/Filter/AbstractGeoDistance.php @@ -70,8 +70,8 @@ public function __construct($key, $location) } /** - * @param string $key - * @return \Elastica\Filter\AbstractGeoDistance current filter + * @param string $key + * @return $this */ public function setKey($key) { @@ -81,9 +81,10 @@ public function setKey($key) } /** - * @param array|string $location - * @return \Elastica\Filter\AbstractGeoDistance * @throws \Elastica\Exception\InvalidException + * + * @param array|string $location + * @return $this */ public function setLocation($location) { @@ -112,8 +113,8 @@ public function setLocation($location) } /** - * @param float $latitude - * @return \Elastica\Filter\AbstractGeoDistance current filter + * @param float $latitude + * @return $this */ public function setLatitude($latitude) { @@ -124,8 +125,8 @@ public function setLatitude($latitude) } /** - * @param float $longitude - * @return \Elastica\Filter\AbstractGeoDistance current filter + * @param float $longitude + * @return $this */ public function setLongitude($longitude) { @@ -136,8 +137,8 @@ public function setLongitude($longitude) } /** - * @param string $geohash - * @return \Elastica\Filter\AbstractGeoDistance current filter + * @param string $geohash + * @return $this */ public function setGeohash($geohash) { @@ -148,8 +149,9 @@ public function setGeohash($geohash) } /** - * @return array|string * @throws \Elastica\Exception\InvalidException + * + * @return array|string */ protected function _getLocationData() { @@ -179,6 +181,8 @@ protected function _getLocationData() /** * @see \Elastica\Param::toArray() * @throws \Elastica\Exception\InvalidException + * + * @return array */ public function toArray() { diff --git a/lib/Elastica/Filter/AbstractGeoShape.php b/lib/Elastica/Filter/AbstractGeoShape.php index 3585293b00..4ffb7b1d78 100644 --- a/lib/Elastica/Filter/AbstractGeoShape.php +++ b/lib/Elastica/Filter/AbstractGeoShape.php @@ -33,11 +33,14 @@ abstract class AbstractGeoShape extends AbstractFilter protected $_relation = self::RELATION_INTERSECT; /** - * @param string $relation + * @param string $relation + * @return $this */ public function setRelation($relation) { $this->_relation = $relation; + + return $this; } /** diff --git a/lib/Elastica/Filter/AbstractMulti.php b/lib/Elastica/Filter/AbstractMulti.php index 027054c28f..220f6b4a9d 100644 --- a/lib/Elastica/Filter/AbstractMulti.php +++ b/lib/Elastica/Filter/AbstractMulti.php @@ -21,7 +21,7 @@ abstract class AbstractMulti extends AbstractFilter * Add filter * * @param \Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Filter\AbstractMulti + * @return $this */ public function addFilter(AbstractFilter $filter) { @@ -33,8 +33,8 @@ public function addFilter(AbstractFilter $filter) /** * Set filters * - * @param array $filters - * @return \Elastica\Filter\AbstractMulti + * @param array $filters + * @return $this */ public function setFilters(array $filters) { @@ -57,6 +57,7 @@ public function getFilters() /** * @see \Elastica\Param::toArray() + * @return array */ public function toArray() { diff --git a/lib/Elastica/Filter/Bool.php b/lib/Elastica/Filter/Bool.php index 018d8ea5a3..6e8f01b6ce 100644 --- a/lib/Elastica/Filter/Bool.php +++ b/lib/Elastica/Filter/Bool.php @@ -39,7 +39,7 @@ class Bool extends AbstractFilter * Adds should filter * * @param array|\Elastica\Filter\AbstractFilter $args Filter data - * @return \Elastica\Filter\Bool Current object + * @return $this */ public function addShould($args) { @@ -50,7 +50,7 @@ public function addShould($args) * Adds must filter * * @param array|\Elastica\Filter\AbstractFilter $args Filter data - * @return \Elastica\Filter\Bool Current object + * @return $this */ public function addMust($args) { @@ -61,7 +61,7 @@ public function addMust($args) * Adds mustNot filter * * @param array|\Elastica\Filter\AbstractFilter $args Filter data - * @return \Elastica\Filter\Bool Current object + * @return $this */ public function addMustNot($args) { @@ -71,10 +71,11 @@ public function addMustNot($args) /** * Adds general filter based on type * + * @throws \Elastica\Exception\InvalidException + * * @param string $type Filter type * @param array|\Elastica\Filter\AbstractFilter $args Filter data - * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Filter\Bool Current object + * @return $this */ protected function _addFilter($type, $args) { @@ -102,6 +103,7 @@ protected function _addFilter($type, $args) * Converts bool filter to array * * @see \Elastica\Filter\AbstractFilter::toArray() + * * @return array Filter array */ public function toArray() diff --git a/lib/Elastica/Filter/BoolNot.php b/lib/Elastica/Filter/BoolNot.php index 1778997b5a..2fb7bd4287 100644 --- a/lib/Elastica/Filter/BoolNot.php +++ b/lib/Elastica/Filter/BoolNot.php @@ -26,7 +26,7 @@ public function __construct(AbstractFilter $filter) * Set filter * * @param \Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Filter\BoolNot + * @return $this */ public function setFilter(AbstractFilter $filter) { diff --git a/lib/Elastica/Filter/Exists.php b/lib/Elastica/Filter/Exists.php index b34dc87cc8..f2b6f78874 100644 --- a/lib/Elastica/Filter/Exists.php +++ b/lib/Elastica/Filter/Exists.php @@ -25,8 +25,8 @@ public function __construct($field) /** * Set field * - * @param string $field - * @return \Elastica\Filter\Exists + * @param string $field + * @return $this */ public function setField($field) { diff --git a/lib/Elastica/Filter/GeoBoundingBox.php b/lib/Elastica/Filter/GeoBoundingBox.php index 3f4d94f6f6..0f3893323b 100644 --- a/lib/Elastica/Filter/GeoBoundingBox.php +++ b/lib/Elastica/Filter/GeoBoundingBox.php @@ -28,10 +28,11 @@ public function __construct($key, array $coordinates) /** * Add coordinates * - * @param string $key Key - * @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element * @throws \Elastica\Exception\InvalidException If $coordinates doesn't have two elements - * @return \Elastica\Filter\GeoBoundingBox Current object + * + * @param string $key Key + * @param array $coordinates Array with top left coordinate as first and bottom right coordinate as second element + * @return $this */ public function addCoordinates($key, array $coordinates) { diff --git a/lib/Elastica/Filter/GeoDistance.php b/lib/Elastica/Filter/GeoDistance.php index 00112ddb09..9c32c22a8f 100644 --- a/lib/Elastica/Filter/GeoDistance.php +++ b/lib/Elastica/Filter/GeoDistance.php @@ -23,10 +23,11 @@ class GeoDistance extends AbstractGeoDistance /** * Create GeoDistance object * - * @param string $key Key - * @param array|string $location Location as array or geohash: array('lat' => 48.86, 'lon' => 2.35) OR 'drm3btev3e86' - * @param string $distance Distance * @throws \Elastica\Exception\InvalidException + * + * @param string $key Key + * @param array|string $location Location as array or geohash: array('lat' => 48.86, 'lon' => 2.35) OR 'drm3btev3e86' + * @param string $distance Distance */ public function __construct($key, $location, $distance) { @@ -36,8 +37,8 @@ public function __construct($key, $location, $distance) } /** - * @param string $distance - * @return \Elastica\Filter\GeoDistance current filter + * @param string $distance + * @return $this */ public function setDistance($distance) { @@ -49,8 +50,8 @@ public function setDistance($distance) /** * See DISTANCE_TYPE_* constants * - * @param string $distanceType - * @return \Elastica\Filter\GeoDistance current filter + * @param string $distanceType + * @return $this */ public function setDistanceType($distanceType) { @@ -62,8 +63,8 @@ public function setDistanceType($distanceType) /** * See OPTIMIZE_BBOX_* constants * - * @param string $optimizeBbox - * @return \Elastica\Filter\GeoDistance current filter + * @param string $optimizeBbox + * @return $this */ public function setOptimizeBbox($optimizeBbox) { diff --git a/lib/Elastica/Filter/GeoDistanceRange.php b/lib/Elastica/Filter/GeoDistanceRange.php index 90e1556359..546350c75e 100644 --- a/lib/Elastica/Filter/GeoDistanceRange.php +++ b/lib/Elastica/Filter/GeoDistanceRange.php @@ -45,8 +45,8 @@ public function __construct($key, $location, array $ranges = array()) } /** - * @param array $ranges - * @return \Elastica\Filter\GeoDistanceRange + * @param array $ranges + * @return $this */ public function setRanges(array $ranges) { @@ -60,10 +60,11 @@ public function setRanges(array $ranges) } /** - * @param string $key - * @param mixed $value - * @return \Elastica\Filter\GeoDistanceRange * @throws \Elastica\Exception\InvalidException + * + * @param string $key + * @param mixed $value + * @return $this */ public function setRange($key, $value) { diff --git a/lib/Elastica/Filter/GeoPolygon.php b/lib/Elastica/Filter/GeoPolygon.php index 8917e35fd0..4e51ff22a2 100644 --- a/lib/Elastica/Filter/GeoPolygon.php +++ b/lib/Elastica/Filter/GeoPolygon.php @@ -42,6 +42,7 @@ public function __construct($key, array $points) * Converts filter to array * * @see \Elastica\Filter\AbstractFilter::toArray() + * * @return array */ public function toArray() diff --git a/lib/Elastica/Filter/GeoShapePreIndexed.php b/lib/Elastica/Filter/GeoShapePreIndexed.php index 7acae81f59..1310972cea 100644 --- a/lib/Elastica/Filter/GeoShapePreIndexed.php +++ b/lib/Elastica/Filter/GeoShapePreIndexed.php @@ -64,6 +64,7 @@ public function __construct($path, $indexedId, $indexedType, $indexedIndex, $ind * Converts filter to array * * @see \Elastica\Filter\AbstractFilter::toArray() + * * @return array */ public function toArray() diff --git a/lib/Elastica/Filter/GeoShapeProvided.php b/lib/Elastica/Filter/GeoShapeProvided.php index 35c9b87e43..3fa02327e7 100644 --- a/lib/Elastica/Filter/GeoShapeProvided.php +++ b/lib/Elastica/Filter/GeoShapeProvided.php @@ -55,6 +55,7 @@ public function __construct($path, array $coordinates, $shapeType = self::TYPE_E * Converts filter to array * * @see \Elastica\Filter\AbstractFilter::toArray() + * * @return array */ public function toArray() diff --git a/lib/Elastica/Filter/GeohashCell.php b/lib/Elastica/Filter/GeohashCell.php index 1794a0e966..9c8131dd51 100644 --- a/lib/Elastica/Filter/GeohashCell.php +++ b/lib/Elastica/Filter/GeohashCell.php @@ -24,8 +24,8 @@ public function __construct($key, $location, $precision = -1, $neighbors = false /** * Set the precision for this filter - * @param string|int $precision Integer length of geohash prefix or distance (3, or "50m") - * @return \Elastica\Filter\GeohashCell + * @param string|int $precision Integer length of geohash prefix or distance (3, or "50m") + * @return $this */ public function setPrecision($precision) { @@ -34,8 +34,8 @@ public function setPrecision($precision) /** * Set the neighbors option for this filter - * @param bool $neighbors If true, filters cells next to the given cell. - * @return \Elastica\Filter\GeohashCell + * @param bool $neighbors If true, filters cells next to the given cell. + * @return $this */ public function setNeighbors($neighbors) { diff --git a/lib/Elastica/Filter/HasChild.php b/lib/Elastica/Filter/HasChild.php index d68d52f3f0..aa855664f0 100644 --- a/lib/Elastica/Filter/HasChild.php +++ b/lib/Elastica/Filter/HasChild.php @@ -32,7 +32,7 @@ public function __construct($query, $type = null) * Sets query object * * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Filter\HasChild Current object + * @return $this */ public function setQuery($query) { @@ -46,7 +46,7 @@ public function setQuery($query) * Sets the filter object * * @param \Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Filter\HasChild Current object + * @return $this */ public function setFilter($filter) { @@ -56,8 +56,8 @@ public function setFilter($filter) /** * Set type of the child document * - * @param string|\Elastica\Type $type Child document type - * @return \Elastica\Filter\HasParent Current object + * @param string|\Elastica\Type $type Child document type + * @return $this */ public function setType($type) { @@ -70,8 +70,8 @@ public function setType($type) /** * Set minimum number of children are required to match for the parent doc to be considered a match - * @param int $count - * @return \Elastica\Filter\HasChild + * @param int $count + * @return $this */ public function setMinimumChildrenCount($count) { @@ -80,8 +80,8 @@ public function setMinimumChildrenCount($count) /** * Set maximum number of children are required to match for the parent doc to be considered a match - * @param int $count - * @return \Elastica\Filter\HasChild + * @param int $count + * @return $this */ public function setMaximumChildrenCount($count) { diff --git a/lib/Elastica/Filter/HasParent.php b/lib/Elastica/Filter/HasParent.php index 360b6ed9c6..3cfac2e19e 100644 --- a/lib/Elastica/Filter/HasParent.php +++ b/lib/Elastica/Filter/HasParent.php @@ -31,7 +31,7 @@ public function __construct($query, $type) * Sets query object * * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Filter\HasParent Current object + * @return $this */ public function setQuery($query) { @@ -45,7 +45,7 @@ public function setQuery($query) * Sets filter object * * @param \Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Filter\HasParent Current object + * @return $this */ public function setFilter($filter) { @@ -55,8 +55,8 @@ public function setFilter($filter) /** * Set type of the parent document * - * @param string|\Elastica\Type $type Parent document type - * @return \Elastica\Filter\HasParent Current object + * @param string|\Elastica\Type $type Parent document type + * @return $this */ public function setType($type) { diff --git a/lib/Elastica/Filter/Ids.php b/lib/Elastica/Filter/Ids.php index 634ecb012e..1a71399e48 100644 --- a/lib/Elastica/Filter/Ids.php +++ b/lib/Elastica/Filter/Ids.php @@ -29,8 +29,8 @@ public function __construct($type = null, array $ids = array()) /** * Adds one more filter to the and filter * - * @param string $id Adds id to filter - * @return \Elastica\Filter\Ids Current object + * @param string $id Adds id to filter + * @return $this */ public function addId($id) { @@ -41,7 +41,7 @@ public function addId($id) * Adds one more type to query * * @param string|\Elastica\Type $type Type name or object - * @return \Elastica\Filter\Ids Current object + * @return $this */ public function addType($type) { @@ -60,7 +60,7 @@ public function addType($type) * Set type * * @param string|\Elastica\Type $type Type name or object - * @return \Elastica\Filter\Ids Current object + * @return $this */ public function setType($type) { @@ -78,8 +78,8 @@ public function setType($type) /** * Sets the ids to filter * - * @param array|string $ids List of ids - * @return \Elastica\Filter\Ids Current object + * @param array|string $ids List of ids + * @return $this */ public function setIds($ids) { diff --git a/lib/Elastica/Filter/Indices.php b/lib/Elastica/Filter/Indices.php index 769c7137ba..7622ef64dd 100644 --- a/lib/Elastica/Filter/Indices.php +++ b/lib/Elastica/Filter/Indices.php @@ -23,7 +23,7 @@ public function __construct(AbstractFilter $filter, array $indices) /** * Set the indices on which this filter should be applied * @param mixed[] $indices - * @return Indices + * @return $this */ public function setIndices(array $indices) { @@ -38,7 +38,7 @@ public function setIndices(array $indices) /** * Adds one more index on which this filter should be applied * @param string|\Elastica\Index $index - * @return Indices + * @return $this */ public function addIndex($index) { @@ -52,7 +52,7 @@ public function addIndex($index) /** * Set the filter to be applied to docs in the specified indices * @param AbstractFilter $filter - * @return Indices + * @return $this */ public function setFilter(AbstractFilter $filter) { @@ -62,7 +62,7 @@ public function setFilter(AbstractFilter $filter) /** * Set the filter to be applied to docs in indices which do not match those specified in the "indices" parameter * @param AbstractFilter $filter - * @return Indices + * @return $this */ public function setNoMatchFilter(AbstractFilter $filter) { diff --git a/lib/Elastica/Filter/Limit.php b/lib/Elastica/Filter/Limit.php index cf3182449d..88011352cf 100644 --- a/lib/Elastica/Filter/Limit.php +++ b/lib/Elastica/Filter/Limit.php @@ -15,8 +15,7 @@ class Limit extends AbstractFilter /** * Construct limit filter * - * @param int $limit Limit - * @return \Elastica\Filter\Limit + * @param int $limit Limit */ public function __construct($limit) { @@ -26,8 +25,8 @@ public function __construct($limit) /** * Set the limit * - * @param int $limit Limit - * @return \Elastica\Filter\Limit + * @param int $limit Limit + * @return $this */ public function setLimit($limit) { diff --git a/lib/Elastica/Filter/Missing.php b/lib/Elastica/Filter/Missing.php index b29595fcb1..5234645ac7 100644 --- a/lib/Elastica/Filter/Missing.php +++ b/lib/Elastica/Filter/Missing.php @@ -27,8 +27,8 @@ public function __construct($field = '') /** * Set field * - * @param string $field - * @return \Elastica\Filter\Missing + * @param string $field + * @return $this */ public function setField($field) { @@ -37,8 +37,8 @@ public function setField($field) /** * Set "existence" parameter - * @param bool $existence - * @return \Elastica\Filter\Missing + * @param bool $existence + * @return $this */ public function setExistence($existence) { @@ -47,8 +47,8 @@ public function setExistence($existence) /** * Set "null_value" parameter - * @param bool $nullValue - * @return \Elastica\Filter\Missing + * @param bool $nullValue + * @return $this */ public function setNullValue($nullValue) { diff --git a/lib/Elastica/Filter/Nested.php b/lib/Elastica/Filter/Nested.php index ef78e52dc3..f5cac71701 100644 --- a/lib/Elastica/Filter/Nested.php +++ b/lib/Elastica/Filter/Nested.php @@ -17,8 +17,8 @@ class Nested extends AbstractFilter /** * Adds field to mlt filter * - * @param string $path Nested object path - * @return \Elastica\Filter\Nested + * @param string $path Nested object path + * @return $this */ public function setPath($path) { @@ -29,7 +29,7 @@ public function setPath($path) * Sets nested query * * @param \Elastica\Query\AbstractQuery $query - * @return \Elastica\Filter\Nested + * @return $this */ public function setQuery(AbstractQuery $query) { @@ -40,7 +40,7 @@ public function setQuery(AbstractQuery $query) * Sets nested filter * * @param \Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Filter\Nested + * @return $this */ public function setFilter(AbstractFilter $filter) { @@ -50,8 +50,8 @@ public function setFilter(AbstractFilter $filter) /** * Set join option * - * @param bool $join - * @return \Elastica\Filter\Nested + * @param bool $join + * @return $this */ public function setJoin($join) { diff --git a/lib/Elastica/Filter/Prefix.php b/lib/Elastica/Filter/Prefix.php index b0efcd51be..edc808df98 100644 --- a/lib/Elastica/Filter/Prefix.php +++ b/lib/Elastica/Filter/Prefix.php @@ -41,8 +41,8 @@ public function __construct($field = '', $prefix = '') /** * Sets the name of the prefix field. * - * @param string $field Field name - * @return \Elastica\Filter\Prefix + * @param string $field Field name + * @return $this */ public function setField($field) { @@ -54,8 +54,8 @@ public function setField($field) /** * Sets the prefix string. * - * @param string $prefix Prefix string - * @return \Elastica\Filter\Prefix + * @param string $prefix Prefix string + * @return $this */ public function setPrefix($prefix) { diff --git a/lib/Elastica/Filter/Query.php b/lib/Elastica/Filter/Query.php index 5abf0282e6..5edb3bf81f 100644 --- a/lib/Elastica/Filter/Query.php +++ b/lib/Elastica/Filter/Query.php @@ -36,9 +36,10 @@ public function __construct($query = null) /** * Set query * - * @param array|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Filter\Query Query object - * @throws \Elastica\Exception\InvalidException Invalid param + * @throws \Elastica\Exception\InvalidException If parameter is invalid + * + * @param array|\Elastica\Query\AbstractQuery $query + * @return $this */ public function setQuery($query) { diff --git a/lib/Elastica/Filter/Range.php b/lib/Elastica/Filter/Range.php index 0a6f1abb1e..a59d4f0e13 100644 --- a/lib/Elastica/Filter/Range.php +++ b/lib/Elastica/Filter/Range.php @@ -35,9 +35,9 @@ public function __construct($fieldName = '', array $args = array()) /** * Ads a field with arguments to the range query * - * @param string $fieldName Field name - * @param array $args Field arguments - * @return \Elastica\Filter\Range + * @param string $fieldName Field name + * @param array $args Field arguments + * @return $this */ public function addField($fieldName, array $args) { @@ -49,8 +49,8 @@ public function addField($fieldName, array $args) /** * Set execution mode * - * @param string $execution Options: "index" or "fielddata" - * @return \Elastica\Filter\Range + * @param string $execution Options: "index" or "fielddata" + * @return $this */ public function setExecution($execution) { @@ -66,6 +66,7 @@ public function setExecution($execution) public function toArray() { $this->setParams(array_merge($this->getParams(), $this->_fields)); + return parent::toArray(); } } diff --git a/lib/Elastica/Filter/Regexp.php b/lib/Elastica/Filter/Regexp.php index 796a38f158..2722a61be5 100644 --- a/lib/Elastica/Filter/Regexp.php +++ b/lib/Elastica/Filter/Regexp.php @@ -36,10 +36,11 @@ class Regexp extends AbstractFilter /** * Create Regexp object * - * @param string $field Field name - * @param string $regexp Regular expression - * @param array $options Regular expression options * @throws \Elastica\Exception\InvalidException + * + * @param string $field Field name + * @param string $regexp Regular expression + * @param array $options Regular expression options */ public function __construct($field = '', $regexp = '', $options = array()) { @@ -51,8 +52,8 @@ public function __construct($field = '', $regexp = '', $options = array()) /** * Sets the name of the regexp field. * - * @param string $field Field name - * @return \Elastica\Filter\Regexp + * @param string $field Field name + * @return $this */ public function setField($field) { @@ -64,8 +65,8 @@ public function setField($field) /** * Sets the regular expression query string. * - * @param string $regexp Regular expression - * @return \Elastica\Filter\Regexp + * @param string $regexp Regular expression + * @return $this */ public function setRegexp($regexp) { @@ -77,8 +78,8 @@ public function setRegexp($regexp) /** * Sets the regular expression query options. * - * @param array $options Regular expression options - * @return \Elastica\Filter\Regexp + * @param array $options Regular expression options + * @return $this */ public function setOptions($options) { diff --git a/lib/Elastica/Filter/Script.php b/lib/Elastica/Filter/Script.php index 9b34b1ec3f..a39fcba583 100644 --- a/lib/Elastica/Filter/Script.php +++ b/lib/Elastica/Filter/Script.php @@ -38,7 +38,7 @@ public function __construct($script = null) * Sets script object * * @param \Elastica\Script|string|array $script - * @return \Elastica\Filter\Script + * @return $this */ public function setScript($script) { diff --git a/lib/Elastica/Filter/Term.php b/lib/Elastica/Filter/Term.php index bfc5d8148c..5d52376e28 100644 --- a/lib/Elastica/Filter/Term.php +++ b/lib/Elastica/Filter/Term.php @@ -25,8 +25,8 @@ public function __construct(array $term = array()) /** * Sets/overwrites key and term directly * - * @param array $term Key value pair - * @return \Elastica\Filter\Term Filter object + * @param array $term Key value pair + * @return $this */ public function setRawTerm(array $term) { @@ -36,9 +36,9 @@ public function setRawTerm(array $term) /** * 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 - * @return \Elastica\Filter\Term Filter object + * @param string $key Key to query + * @param string|array $value Values(s) for the query. Boost can be set with array + * @return $this */ public function setTerm($key, $value) { diff --git a/lib/Elastica/Filter/Terms.php b/lib/Elastica/Filter/Terms.php index 036c417cf3..a82e1827ca 100644 --- a/lib/Elastica/Filter/Terms.php +++ b/lib/Elastica/Filter/Terms.php @@ -49,9 +49,9 @@ public function __construct($key = '', array $terms = array()) /** * Sets key and terms for the filter * - * @param string $key Terms key - * @param array $terms Terms for the query. - * @return \Elastica\Filter\Terms + * @param string $key Terms key + * @param array $terms Terms for the query. + * @return $this */ public function setTerms($key, array $terms) { @@ -68,7 +68,7 @@ public function setTerms($key, array $terms) * @param string $id id of the document from which to fetch the terms values * @param string $path the field from which to fetch the values for the filter * @param string|array|\Elastica\Index $options An array of options or the index from which to fetch the terms values. Defaults to the current index. - * @return \Elastica\Filter\Terms Filter object + * @return $this */ public function setLookup($key, $type, $id, $path, $options = array()) { @@ -104,8 +104,8 @@ public function setLookup($key, $type, $id, $path, $options = array()) /** * Adds an additional term to the query * - * @param string $term Filter term - * @return \Elastica\Filter\Terms Filter object + * @param string $term Filter term + * @return $this */ public function addTerm($term) { @@ -119,7 +119,8 @@ public function addTerm($term) * * @see \Elastica\Filter\AbstractFilter::toArray() * @throws \Elastica\Exception\InvalidException - * @return array data array + * + * @return array */ public function toArray() { @@ -134,8 +135,8 @@ public function toArray() /** * Set execution mode * - * @param string $execution Options: "bool", "and", "or", "plain" or "fielddata" - * @return \Elastica\Filter\Terms + * @param string $execution Options: "bool", "and", "or", "plain" or "fielddata" + * @return $this */ public function setExecution($execution) { diff --git a/lib/Elastica/Filter/Type.php b/lib/Elastica/Filter/Type.php index 4595e46bb3..38278f8c97 100644 --- a/lib/Elastica/Filter/Type.php +++ b/lib/Elastica/Filter/Type.php @@ -22,8 +22,7 @@ class Type extends AbstractFilter /** * Construct Type Filter * - * @param string $typeName Type name - * @return \Elastica\Filter\Type + * @param string $typeName Type name */ public function __construct($typeName = null) { @@ -35,8 +34,8 @@ public function __construct($typeName = null) /** * Ads a field with arguments to the range query * - * @param string $typeName Type name - * @return \Elastica\Filter\Type current object + * @param string $typeName Type name + * @return $this */ public function setType($typeName) { @@ -49,6 +48,7 @@ public function setType($typeName) * Convert object to array * * @see \Elastica\Filter\AbstractFilter::toArray() + * * @return array Filter array */ public function toArray() diff --git a/lib/Elastica/Index.php b/lib/Elastica/Index.php index e410f9c2aa..3e55cfd4bb 100644 --- a/lib/Elastica/Index.php +++ b/lib/Elastica/Index.php @@ -38,9 +38,10 @@ class Index implements SearchableInterface * * All the communication to and from an index goes of this object * - * @param \Elastica\Client $client Client object - * @param string $name Index name * @throws \Elastica\Exception\InvalidException + * + * @param \Elastica\Client $client Client object + * @param string $name Index name */ public function __construct(Client $client, $name) { @@ -203,14 +204,15 @@ public function refresh() /** * Creates a new index with the given arguments * - * @param array $args OPTIONAL Arguments to use - * @param bool|array $options OPTIONAL - * bool=> Deletes index first if already exists (default = false). - * array => Associative array of options (option=>value) * @throws \Elastica\Exception\InvalidException * @throws \Elastica\Exception\ResponseException - * @return array Server response * @link http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html + * + * @param array $args OPTIONAL Arguments to use + * @param bool|array $options OPTIONAL + * bool=> Deletes index first if already exists (default = false). + * array => Associative array of options (option=>value) + * @return array Server response */ public function create(array $args = array(), $options = null) { diff --git a/lib/Elastica/JSON.php b/lib/Elastica/JSON.php index 2cce64a42b..576be89ead 100644 --- a/lib/Elastica/JSON.php +++ b/lib/Elastica/JSON.php @@ -14,10 +14,11 @@ class JSON /** * Parse JSON string to an array * - * @param string $json JSON string to parse - * @return array PHP array representation of JSON string * @link http://php.net/manual/en/function.json-decode.php * @link http://www.php.net/manual/en/function.json-last-error.php + * + * @param string $json JSON string to parse + * @return array PHP array representation of JSON string */ public static function parse(/* inherit from json_decode */) { @@ -45,9 +46,10 @@ public static function parse(/* inherit from json_decode */) /** * Convert input to JSON string with standard options * + * @link http://php.net/manual/en/function.json-encode.php + * * @param mixed check args for PHP function json_encode * @return string Valid JSON representation of $input - * @link http://php.net/manual/en/function.json-encode.php */ public static function stringify(/* inherit from json_encode */) { diff --git a/lib/Elastica/Log.php b/lib/Elastica/Log.php index e3d22be16c..7a06ef6f39 100644 --- a/lib/Elastica/Log.php +++ b/lib/Elastica/Log.php @@ -60,8 +60,8 @@ public function log($level, $message, array $context = array()) /** * Enable/disable log or set log path * - * @param bool|string $log Enables log or sets log path - * @return \Elastica\Log + * @param bool|string $log Enables log or sets log path + * @return $this */ public function setLog($log) { diff --git a/lib/Elastica/Multi/ResultSet.php b/lib/Elastica/Multi/ResultSet.php index aec25185aa..e8171b4927 100644 --- a/lib/Elastica/Multi/ResultSet.php +++ b/lib/Elastica/Multi/ResultSet.php @@ -51,9 +51,10 @@ public function __construct(Response $response, array $searches) } /** - * @param \Elastica\Response $response - * @param array|\Elastica\Search[] $searches * @throws \Elastica\Exception\InvalidException + * + * @param \Elastica\Response $response + * @param array|\Elastica\Search[] $searches */ protected function _init(Response $response, array $searches) { diff --git a/lib/Elastica/Multi/Search.php b/lib/Elastica/Multi/Search.php index e89b26e6b5..e7e46a3b67 100644 --- a/lib/Elastica/Multi/Search.php +++ b/lib/Elastica/Multi/Search.php @@ -51,8 +51,8 @@ public function getClient() } /** - * @param \Elastica\Client $client - * @return \Elastica\Multi\Search + * @param \Elastica\Client $client + * @return $this */ public function setClient(Client $client) { @@ -62,7 +62,7 @@ public function setClient(Client $client) } /** - * @return \Elastica\Multi\Search + * @return $this */ public function clearSearches() { @@ -72,9 +72,9 @@ public function clearSearches() } /** - * @param \Elastica\Search $search - * @param string $key Optional key - * @return \Elastica\Multi\Search + * @param \Elastica\Search $search + * @param string $key Optional key + * @return $this */ public function addSearch(BaseSearch $search, $key = null) { @@ -89,7 +89,7 @@ public function addSearch(BaseSearch $search, $key = null) /** * @param array|\Elastica\Search[] $searches - * @return \Elastica\Multi\Search + * @return $this */ public function addSearches(array $searches) { @@ -102,7 +102,7 @@ public function addSearches(array $searches) /** * @param array|\Elastica\Search[] $searches - * @return \Elastica\Multi\Search + * @return $this */ public function setSearches(array $searches) { @@ -121,8 +121,8 @@ public function getSearches() } /** - * @param string $searchType - * @return \Elastica\Multi\Search + * @param string $searchType + * @return $this */ public function setSearchType($searchType) { diff --git a/lib/Elastica/Param.php b/lib/Elastica/Param.php index f84e69dab2..7f5165f690 100644 --- a/lib/Elastica/Param.php +++ b/lib/Elastica/Param.php @@ -62,9 +62,9 @@ protected function _getBaseName() /** * Sets params not inside params array * - * @param string $key - * @param mixed $value - * @return \Elastica\Param + * @param string $key + * @param mixed $value + * @return $this */ protected function _setRawParam($key, $value) { @@ -76,8 +76,8 @@ protected function _setRawParam($key, $value) /** * Sets (overwrites) the value at the given key * - * @param string $key Key to set - * @param mixed $value Key Value + * @param string $key Key to set + * @param mixed $value Key Value * @return $this */ public function setParam($key, $value) @@ -90,7 +90,7 @@ public function setParam($key, $value) /** * Sets (overwrites) all params of this object * - * @param array $params Parameter list + * @param array $params Parameter list * @return $this */ public function setParams(array $params) @@ -105,8 +105,8 @@ public function setParams(array $params) * * This function can be used to add an array of params * - * @param string $key Param key - * @param mixed $value Value to set + * @param string $key Param key + * @param mixed $value Value to set * @return $this */ public function addParam($key, $value) @@ -127,9 +127,10 @@ public function addParam($key, $value) /** * Returns a specific param * - * @param string $key Key to return - * @return mixed Key value * @throws \Elastica\Exception\InvalidException If requested key is not set + * + * @param string $key Key to return + * @return mixed Key value */ public function getParam($key) { diff --git a/lib/Elastica/Query.php b/lib/Elastica/Query.php index fdd680be39..37e3e93af1 100644 --- a/lib/Elastica/Query.php +++ b/lib/Elastica/Query.php @@ -60,9 +60,10 @@ public function __construct($query = null) * * If query is empty, * - * @param mixed $query * @throws \Elastica\Exception\NotImplementedException - * @return \Elastica\Query + * + * @param mixed $query + * @return self */ public static function create($query) { @@ -97,8 +98,8 @@ public static function create($query) /** * Sets query as raw array. Will overwrite all already set arguments * - * @param array $query Query array - * @return \Elastica\Query Query object + * @param array $query Query array + * @return $this */ public function setRawQuery(array $query) { @@ -111,7 +112,7 @@ public function setRawQuery(array $query) * Sets the query * * @param \Elastica\Query\AbstractQuery $query Query object - * @return \Elastica\Query Query object + * @return $this */ public function setQuery(AbstractQuery $query) { @@ -132,7 +133,7 @@ public function getQuery() * Set Filter * * @param \Elastica\Filter\AbstractFilter $filter Filter object - * @return \Elastica\Query Current object + * @return $this * @link https://github.com/elasticsearch/elasticsearch/issues/7422 * @deprecated */ @@ -146,8 +147,8 @@ public function setFilter(AbstractFilter $filter) /** * Sets the start from which the search results should be returned * - * @param int $from - * @return \Elastica\Query Query object + * @param int $from + * @return $this */ public function setFrom($from) { @@ -158,8 +159,8 @@ public function setFrom($from) * Sets sort arguments for the query * Replaces existing values * - * @param array $sortArgs Sorting arguments - * @return \Elastica\Query Query object + * @param array $sortArgs Sorting arguments + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/sort.html */ public function setSort(array $sortArgs) @@ -170,8 +171,8 @@ public function setSort(array $sortArgs) /** * Adds a sort param to the query * - * @param mixed $sort Sort parameter - * @return \Elastica\Query Query object + * @param mixed $sort Sort parameter + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/sort.html */ public function addSort($sort) @@ -182,8 +183,8 @@ public function addSort($sort) /** * Sets highlight arguments for the query * - * @param array $highlightArgs Set all highlight arguments - * @return \Elastica\Query Query object + * @param array $highlightArgs Set all highlight arguments + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/highlighting.html */ public function setHighlight(array $highlightArgs) @@ -194,8 +195,8 @@ public function setHighlight(array $highlightArgs) /** * Adds a highlight argument * - * @param mixed $highlight Add highlight argument - * @return \Elastica\Query Query object + * @param mixed $highlight Add highlight argument + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/highlighting.html */ public function addHighlight($highlight) @@ -206,8 +207,8 @@ public function addHighlight($highlight) /** * Sets maximum number of results for this query * - * @param int $size OPTIONAL Maximal number of results for query (default = 10) - * @return \Elastica\Query Query object + * @param int $size OPTIONAL Maximal number of results for query (default = 10) + * @return $this */ public function setSize($size = 10) { @@ -218,8 +219,8 @@ public function setSize($size = 10) * Alias for setSize * * @deprecated Use the setSize() method, this method will be removed in future releases - * @param int $limit OPTIONAL Maximal number of results for query (default = 10) - * @return \Elastica\Query Query object + * @param int $limit OPTIONAL Maximal number of results for query (default = 10) + * @return $this */ public function setLimit($limit = 10) { @@ -229,8 +230,8 @@ public function setLimit($limit = 10) /** * Enables explain on the query * - * @param bool $explain OPTIONAL Enabled or disable explain (default = true) - * @return \Elastica\Query Current object + * @param bool $explain OPTIONAL Enabled or disable explain (default = true) + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/explain.html */ public function setExplain($explain = true) @@ -241,8 +242,8 @@ public function setExplain($explain = true) /** * Enables version on the query * - * @param bool $version OPTIONAL Enabled or disable version (default = true) - * @return \Elastica\Query Current object + * @param bool $version OPTIONAL Enabled or disable version (default = true) + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/version.html */ public function setVersion($version = true) @@ -255,8 +256,8 @@ public function setVersion($version = true) * NOTICE php will encode modified(or named keys) array into object format in json format request * so the fields array must a sequence(list) type of array * - * @param array $fields Fields to be returned - * @return \Elastica\Query Current object + * @param array $fields Fields to be returned + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/fields.html */ public function setFields(array $fields) @@ -268,7 +269,7 @@ public function setFields(array $fields) * Set script fields * * @param array|\Elastica\ScriptFields $scriptFields Script fields - * @return \Elastica\Query Current object + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/script-fields.html */ public function setScriptFields($scriptFields) @@ -285,7 +286,7 @@ public function setScriptFields($scriptFields) * * @param string $name * @param \Elastica\Script $script Script object - * @return \Elastica\Query Query object + * @return $this */ public function addScriptField($name, Script $script) { @@ -297,8 +298,8 @@ public function addScriptField($name, Script $script) /** * Sets all facets for this query object. Replaces existing facets * - * @param array $facets List of facet objects - * @return \Elastica\Query Query object + * @param array $facets List of facet objects + * @return $this * @link http://www.elasticsearch.org/guide/reference/api/search/facets/ */ public function setFacets(array $facets) @@ -315,7 +316,7 @@ public function setFacets(array $facets) * Adds a Facet to the query * * @param \Elastica\Facet\AbstractFacet $facet Facet object - * @return \Elastica\Query Query object + * @return $this */ public function addFacet(AbstractFacet $facet) { @@ -328,7 +329,7 @@ public function addFacet(AbstractFacet $facet) * Adds an Aggregation to the query * * @param AbstractAggregation $agg - * @return \Elastica\Query Query object + * @return $this */ public function addAggregation(AbstractAggregation $agg) { @@ -365,9 +366,10 @@ public function toArray() /** * Allows filtering of documents based on a minimum score * - * @param int $minScore Minimum score to filter documents by * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Query Query object + * + * @param int $minScore Minimum score to filter documents by + * @return $this */ public function setMinScore($minScore) { @@ -381,7 +383,8 @@ public function setMinScore($minScore) /** * Add a suggest term * - * @param \Elastica\Suggest $suggest suggestion object + * @param \Elastica\Suggest $suggest suggestion object + * @return $this */ public function setSuggest(Suggest $suggest) { @@ -389,14 +392,17 @@ public function setSuggest(Suggest $suggest) $this->getParams(), $suggest->toArray() )); + $this->_suggest = 1; + + return $this; } /** * Add a Rescore * * @param \Elastica\Rescore\AbstractRescore $rescore suggestion object - * @return \Elastica\Query Current object + * @return $this */ public function setRescore($rescore) { @@ -406,8 +412,8 @@ public function setRescore($rescore) /** * Sets the _source field to be returned with every hit * - * @param array $fields Fields to be returned - * @return \Elastica\Query Current object + * @param array $fields Fields to be returned + * @return $this * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-request-source-filtering.html */ public function setSource(array $fields) @@ -419,7 +425,7 @@ public function setSource(array $fields) * Sets post_filter argument for the query. The filter is applied after the query has executed * * @param array|\Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Query Current object + * @return $this * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-post-filter.html */ public function setPostFilter($filter) diff --git a/lib/Elastica/Query/Bool.php b/lib/Elastica/Query/Bool.php index c5c0881209..c44928307e 100644 --- a/lib/Elastica/Query/Bool.php +++ b/lib/Elastica/Query/Bool.php @@ -18,7 +18,7 @@ class Bool extends AbstractQuery * Add should part to query * * @param \Elastica\Query\AbstractQuery|array $args Should query - * @return \Elastica\Query\Bool Current object + * @return $this */ public function addShould($args) { @@ -29,7 +29,7 @@ public function addShould($args) * Add must part to query * * @param \Elastica\Query\AbstractQuery|array $args Must query - * @return \Elastica\Query\Bool Current object + * @return $this */ public function addMust($args) { @@ -40,7 +40,7 @@ public function addMust($args) * Add must not part to query * * @param \Elastica\Query\AbstractQuery|array $args Must not query - * @return \Elastica\Query\Bool Current object + * @return $this */ public function addMustNot($args) { @@ -50,10 +50,11 @@ public function addMustNot($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 + * + * @param string $type Query type + * @param \Elastica\Query\AbstractQuery|array $args Query + * @return $this */ protected function _addQuery($type, $args) { @@ -71,8 +72,8 @@ protected function _addQuery($type, $args) /** * Sets boost value of this query * - * @param float $boost Boost value - * @return \Elastica\Query\Bool Current object + * @param float $boost Boost value + * @return $this */ public function setBoost($boost) { @@ -82,8 +83,8 @@ public function setBoost($boost) /** * Set the minimum number of of should match * - * @param int $minimumNumberShouldMatch Should match minimum - * @return \Elastica\Query\Bool Current object + * @param int $minimumNumberShouldMatch Should match minimum + * @return $this */ public function setMinimumNumberShouldMatch($minimumNumberShouldMatch) { diff --git a/lib/Elastica/Query/Boosting.php b/lib/Elastica/Query/Boosting.php index 9a84f9dc87..4d7f80f79a 100644 --- a/lib/Elastica/Query/Boosting.php +++ b/lib/Elastica/Query/Boosting.php @@ -14,8 +14,8 @@ class Boosting extends AbstractQuery /** * Set the positive query for this Boosting Query - * @param AbstractQuery $query - * @return \Elastica\Query\Boosting + * @param AbstractQuery $query + * @return $this */ public function setPositiveQuery(AbstractQuery $query) { @@ -24,8 +24,8 @@ public function setPositiveQuery(AbstractQuery $query) /** * Set the negative query for this Boosting Query - * @param AbstractQuery $query - * @return \Elastica\Query\Boosting + * @param AbstractQuery $query + * @return $this */ public function setNegativeQuery(AbstractQuery $query) { @@ -34,8 +34,8 @@ public function setNegativeQuery(AbstractQuery $query) /** * Set the negative_boost parameter for this Boosting Query - * @param Float $negativeBoost - * @return \Elastica\Query\Boosting + * @param Float $negativeBoost + * @return $this */ public function setNegativeBoost($negativeBoost) { diff --git a/lib/Elastica/Query/Builder.php b/lib/Elastica/Query/Builder.php index c12a534a03..b7ff1eb6b7 100644 --- a/lib/Elastica/Query/Builder.php +++ b/lib/Elastica/Query/Builder.php @@ -28,7 +28,7 @@ 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) { @@ -77,7 +77,7 @@ public function toArray() * * @param boolean $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function allowLeadingWildcard($bool = true) { @@ -89,7 +89,7 @@ public function allowLeadingWildcard($bool = true) * * @param boolean $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function analyzeWildcard($bool = true) { @@ -101,7 +101,7 @@ public function analyzeWildcard($bool = true) * * @param string $analyzer Analyzer to use. * - * @return \Elastica\Query\Builder + * @return $this */ public function analyzer($analyzer) { @@ -113,7 +113,7 @@ public function analyzer($analyzer) * * @param boolean $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function autoGeneratePhraseQueries($bool = true) { @@ -132,7 +132,7 @@ public function autoGeneratePhraseQueries($bool = true) * * The occurrence types are: must, should, must_not. * - * @return \Elastica\Query\Builder + * @return $this */ public function bool() { @@ -144,7 +144,7 @@ public function bool() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function boolClose() { @@ -156,7 +156,7 @@ public function boolClose() * * @param float $boost Defaults to 1.0. * - * @return \Elastica\Query\Builder + * @return $this */ public function boost($boost = 1.0) { @@ -166,7 +166,7 @@ public function boost($boost = 1.0) /** * Close a previously opened brace. * - * @return \Elastica\Query\Builder + * @return $this */ public function close() { @@ -183,7 +183,7 @@ public function close() * * Maps to Lucene ConstantScoreQuery. * - * @return \Elastica\Query\Builder + * @return $this */ public function constantScore() { @@ -195,7 +195,7 @@ public function constantScore() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function constantScoreClose() { @@ -207,7 +207,7 @@ public function constantScoreClose() * * @param string $field Defaults to _all. * - * @return \Elastica\Query\Builder + * @return $this */ public function defaultField($field = '_all') { @@ -223,7 +223,7 @@ public function defaultField($field = '_all') * * @param string $operator Defaults to OR. * - * @return \Elastica\Query\Builder + * @return $this */ public function defaultOperator($operator = 'OR') { @@ -238,7 +238,7 @@ public function defaultOperator($operator = 'OR') * produced by any subquery, plus a tie breaking increment for any additional * matching subqueries. * - * @return \Elastica\Query\Builder + * @return $this */ public function disMax() { @@ -250,7 +250,7 @@ public function disMax() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function disMaxClose() { @@ -262,7 +262,7 @@ public function disMaxClose() * * @param boolean $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function enablePositionIncrements($bool = true) { @@ -274,7 +274,7 @@ public function enablePositionIncrements($bool = true) * * @param boolean $value Turn on / off explain. * - * @return \Elastica\Query\Builder + * @return $this */ public function explain($value = true) { @@ -292,7 +292,7 @@ public function explain($value = true) * Elasticsearch supports more advanced facet implementations, such as * statistical or date histogram facets. * - * @return \Elastica\Query\Builder + * @return $this */ public function facets() { @@ -304,7 +304,7 @@ public function facets() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function facetsClose() { @@ -314,10 +314,9 @@ public function facetsClose() /** * Add a specific field / value entry. * - * @param string $name Field to add. - * @param mixed $value Value to set. - * - * @return \Elastica\Query\Builder + * @param string $name Field to add. + * @param mixed $value Value to set. + * @return $this */ public function field($name, $value) { @@ -351,7 +350,7 @@ public function field($name, $value) * ->rangeClose() * ->queryClose(); * - * @return \Elastica\Query\Builder + * @return $this */ public function fieldClose() { @@ -363,7 +362,7 @@ public function fieldClose() * * @param string $name Field name. * - * @return \Elastica\Query\Builder + * @return $this */ public function fieldOpen($name) { @@ -378,7 +377,7 @@ public function fieldOpen($name) * * @param array $fields Array of fields to return. * - * @return \Elastica\Query\Builder + * @return $this */ public function fields(array $fields) { @@ -396,7 +395,7 @@ public function fields(array $fields) /** * Open a 'filter' block. * - * @return \Elastica\Query\Builder + * @return $this */ public function filter() { @@ -406,7 +405,7 @@ public function filter() /** * Close a filter block. * - * @return \Elastica\Query\Builder + * @return $this */ public function filterClose() { @@ -416,7 +415,7 @@ public function filterClose() /** * Query. * - * @return \Elastica\Query\Builder + * @return $this */ public function filteredQuery() { @@ -428,7 +427,7 @@ public function filteredQuery() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function filteredQueryClose() { @@ -440,7 +439,7 @@ public function filteredQueryClose() * * @param integer $value Result number to start from. * - * @return \Elastica\Query\Builder + * @return $this */ public function from($value = 0) { @@ -452,7 +451,7 @@ public function from($value = 0) * * @param float $value Defaults to 0.5. * - * @return \Elastica\Query\Builder + * @return $this */ public function fuzzyMinSim($value = 0.5) { @@ -464,7 +463,7 @@ public function fuzzyMinSim($value = 0.5) * * @param integer $value Defaults to 0. * - * @return \Elastica\Query\Builder + * @return $this */ public function fuzzyPrefixLength($value = 0) { @@ -478,7 +477,7 @@ public function fuzzyPrefixLength($value = 0) * * @param mixed $value Value to be gt. * - * @return \Elastica\Query\Builder + * @return $this */ public function gt($value) { @@ -492,7 +491,7 @@ public function gt($value) * * @param mixed $value Value to be gte to. * - * @return \Elastica\Query\Builder + * @return $this */ public function gte($value) { @@ -504,7 +503,7 @@ public function gte($value) * * @param boolean $bool Defaults to true. * - * @return \Elastica\Query\Builder + * @return $this */ public function lowercaseExpandedTerms($bool = true) { @@ -518,7 +517,7 @@ public function lowercaseExpandedTerms($bool = true) * * @param mixed $value Value to be lt. * - * @return \Elastica\Query\Builder + * @return $this */ public function lt($value) { @@ -532,7 +531,7 @@ public function lt($value) * * @param mixed $value Value to be lte to. * - * @return \Elastica\Query\Builder + * @return $this */ public function lte($value) { @@ -548,7 +547,7 @@ public function lte($value) * * @param float $boost Boost to use. * - * @return \Elastica\Query\Builder + * @return $this */ public function matchAll($boost = null) { @@ -566,7 +565,7 @@ public function matchAll($boost = null) * * @param integer $minimum Minimum number that should match. * - * @return \Elastica\Query\Builder + * @return $this */ public function minimumNumberShouldMatch($minimum) { @@ -576,7 +575,7 @@ public function minimumNumberShouldMatch($minimum) /** * The clause (query) must appear in matching documents. * - * @return \Elastica\Query\Builder + * @return $this */ public function must() { @@ -588,7 +587,7 @@ public function must() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function mustClose() { @@ -601,7 +600,7 @@ public function mustClose() * 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() { @@ -613,7 +612,7 @@ public function mustNot() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function mustNotClose() { @@ -623,7 +622,7 @@ public function mustNotClose() /** * Add an opening brace. * - * @return \Elastica\Query\Builder + * @return $this */ public function open() { @@ -639,7 +638,7 @@ public function open() * * @param integer $value Defaults to 0. * - * @return \Elastica\Query\Builder + * @return $this */ public function phraseSlop($value = 0) { @@ -649,7 +648,7 @@ public function phraseSlop($value = 0) /** * Query. * - * @return \Elastica\Query\Builder + * @return $this */ public function prefix() { @@ -661,7 +660,7 @@ public function prefix() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function prefixClose() { @@ -673,7 +672,7 @@ public function prefixClose() * * @param array $queries Array of queries. * - * @return \Elastica\Query\Builder + * @return $this */ public function queries(array $queries) { @@ -691,7 +690,7 @@ public function queries(array $queries) /** * Open a query block. * - * @return \Elastica\Query\Builder + * @return $this */ public function query() { @@ -703,7 +702,7 @@ public function query() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function queryClose() { @@ -715,7 +714,7 @@ public function queryClose() * * A query that uses a query parser in order to parse its content * - * @return \Elastica\Query\Builder + * @return $this */ public function queryString() { @@ -727,7 +726,7 @@ public function queryString() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function queryStringClose() { @@ -737,7 +736,7 @@ public function queryStringClose() /** * Open a range block. * - * @return \Elastica\Query\Builder + * @return $this */ public function range() { @@ -749,7 +748,7 @@ public function range() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function rangeClose() { @@ -762,7 +761,7 @@ public function rangeClose() * 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() { @@ -774,7 +773,7 @@ public function should() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function shouldClose() { @@ -786,7 +785,7 @@ public function shouldClose() * * @param integer $value Number of records to return. * - * @return \Elastica\Query\Builder + * @return $this */ public function size($value = 10) { @@ -796,7 +795,7 @@ public function size($value = 10) /** * Allows to add one or more sort on specific fields. * - * @return \Elastica\Query\Builder + * @return $this */ public function sort() { @@ -808,7 +807,7 @@ public function sort() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function sortClose() { @@ -821,7 +820,7 @@ public function sortClose() * @param string $name Field to sort. * @param boolean $reverse Reverse direction. * - * @return \Elastica\Query\Builder + * @return $this */ public function sortField($name, $reverse = false) { @@ -839,7 +838,7 @@ public function sortField($name, $reverse = false) * @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) { @@ -861,7 +860,7 @@ public function sortFields(array $fields) * * The term query maps to Lucene TermQuery. * - * @return \Elastica\Query\Builder + * @return $this */ public function term() { @@ -873,7 +872,7 @@ public function term() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function termClose() { @@ -883,7 +882,7 @@ public function termClose() /** * Open a 'text_phrase' block. * - * @return \Elastica\Query\Builder + * @return $this */ public function textPhrase() { @@ -893,7 +892,7 @@ public function textPhrase() /** * Close a 'text_phrase' block. * - * @return \Elastica\Query\Builder + * @return $this */ public function textPhraseClose() { @@ -905,7 +904,7 @@ public function textPhraseClose() * * @param float $multiplier Multiplier to use. * - * @return \Elastica\Query\Builder + * @return $this */ public function tieBreakerMultiplier($multiplier) { @@ -915,7 +914,7 @@ public function tieBreakerMultiplier($multiplier) /** * Query. * - * @return \Elastica\Query\Builder + * @return $this */ public function wildcard() { @@ -927,7 +926,7 @@ public function wildcard() * * Alias of close() for ease of reading in source. * - * @return \Elastica\Query\Builder + * @return $this */ public function wildcardClose() { diff --git a/lib/Elastica/Query/Common.php b/lib/Elastica/Query/Common.php index 25f8a542e1..49b3fc8aeb 100644 --- a/lib/Elastica/Query/Common.php +++ b/lib/Elastica/Query/Common.php @@ -36,8 +36,8 @@ public function __construct($field, $query, $cutoffFrequency) /** * Set the field on which to query - * @param string $field the field on which to query - * @return \Elastica\Query\Common + * @param string $field the field on which to query + * @return $this */ public function setField($field) { @@ -48,8 +48,8 @@ public function setField($field) /** * Set the query string for this query - * @param string $query - * @return \Elastica\Query\Common + * @param string $query + * @return $this */ public function setQuery($query) { @@ -58,8 +58,8 @@ public function setQuery($query) /** * 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 + * @param float $frequency percentage in decimal form (.001 == 0.1%) + * @return $this */ public function setCutoffFrequency($frequency) { @@ -68,8 +68,8 @@ public function setCutoffFrequency($frequency) /** * Set the logic operator for low frequency terms - * @param string $operator see OPERATOR_* class constants for options - * @return \Elastica\Query\Common + * @param string $operator see OPERATOR_* class constants for options + * @return $this */ public function setLowFrequencyOperator($operator) { @@ -78,8 +78,8 @@ public function setLowFrequencyOperator($operator) /** * Set the logic operator for high frequency terms - * @param string $operator see OPERATOR_* class constants for options - * @return \Elastica\Query\Common + * @param string $operator see OPERATOR_* class constants for options + * @return $this */ public function setHighFrequencyOperator($operator) { @@ -88,8 +88,8 @@ public function setHighFrequencyOperator($operator) /** * Set the minimum_should_match parameter - * @param int|string $minimum minimum number of low frequency terms which must be present - * @return \Elastica\Query\Common + * @param int|string $minimum minimum number of low frequency terms which must be present + * @return $this * @link Possible values for minimum_should_match http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html */ public function setMinimumShouldMatch($minimum) @@ -99,8 +99,8 @@ public function setMinimumShouldMatch($minimum) /** * Set the boost for this query - * @param float $boost - * @return \Elastica\Query\Common + * @param float $boost + * @return $this */ public function setBoost($boost) { @@ -109,8 +109,8 @@ public function setBoost($boost) /** * Set the analyzer for this query - * @param string $analyzer - * @return \Elastica\Query\Common + * @param string $analyzer + * @return $this */ public function setAnalyzer($analyzer) { @@ -119,8 +119,8 @@ public function setAnalyzer($analyzer) /** * 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 + * @param bool $disable disable_coord is false by default + * @return $this */ public function setDisableCoord($disable = true) { @@ -129,9 +129,9 @@ public function setDisableCoord($disable = true) /** * Set a parameter in the body of this query - * @param string $key parameter key - * @param mixed $value parameter value - * @return \Elastica\Query\Common + * @param string $key parameter key + * @param mixed $value parameter value + * @return $this */ public function setQueryParam($key, $value) { diff --git a/lib/Elastica/Query/ConstantScore.php b/lib/Elastica/Query/ConstantScore.php index 66ec0ec974..93f9306487 100644 --- a/lib/Elastica/Query/ConstantScore.php +++ b/lib/Elastica/Query/ConstantScore.php @@ -30,7 +30,7 @@ public function __construct($filter = null) * Set filter * * @param array|\Elastica\Filter\AbstractFilter $filter - * @return \Elastica\Query\ConstantScore Query object + * @return $this */ public function setFilter($filter) { @@ -45,7 +45,7 @@ public function setFilter($filter) * Set query * * @param array|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\ConstantScore Query object + * @return $this */ public function setQuery($query) { @@ -59,8 +59,8 @@ public function setQuery($query) /** * Set boost * - * @param float $boost - * @return \Elastica\Query\ConstantScore + * @param float $boost + * @return $this */ public function setBoost($boost) { diff --git a/lib/Elastica/Query/DisMax.php b/lib/Elastica/Query/DisMax.php index 7b1b9f3960..4eea7e0f3b 100644 --- a/lib/Elastica/Query/DisMax.php +++ b/lib/Elastica/Query/DisMax.php @@ -17,9 +17,10 @@ class DisMax extends AbstractQuery /** * Adds a query to the current object * - * @param \Elastica\Query\AbstractQuery|array $args Query - * @return \Elastica\Query\DisMax * @throws \Elastica\Exception\InvalidException If not valid query + * + * @param \Elastica\Query\AbstractQuery|array $args Query + * @return $this */ public function addQuery($args) { @@ -37,8 +38,8 @@ public function addQuery($args) /** * Set boost * - * @param float $boost - * @return \Elastica\Query\DisMax + * @param float $boost + * @return $this */ public function setBoost($boost) { @@ -50,8 +51,8 @@ public function setBoost($boost) * * 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/lib/Elastica/Query/Filtered.php b/lib/Elastica/Query/Filtered.php index 26df75d7f6..06a693038e 100644 --- a/lib/Elastica/Query/Filtered.php +++ b/lib/Elastica/Query/Filtered.php @@ -31,7 +31,7 @@ public function __construct(AbstractQuery $query = null, AbstractFilter $filter * Sets a query * * @param \Elastica\Query\AbstractQuery $query Query object - * @return \Elastica\Query\Filtered Current object + * @return $this */ public function setQuery(AbstractQuery $query = null) { @@ -42,7 +42,7 @@ public function setQuery(AbstractQuery $query = null) * Sets the filter * * @param \Elastica\Filter\AbstractFilter $filter Filter object - * @return \Elastica\Query\Filtered Current object + * @return $this */ public function setFilter(AbstractFilter $filter = null) { diff --git a/lib/Elastica/Query/FunctionScore.php b/lib/Elastica/Query/FunctionScore.php index f2a666f556..3f48faa46b 100644 --- a/lib/Elastica/Query/FunctionScore.php +++ b/lib/Elastica/Query/FunctionScore.php @@ -34,8 +34,8 @@ class FunctionScore extends AbstractQuery /** * Set the child query for this function_score query - * @param AbstractQuery $query - * @return \Elastica\Query\FunctionScore + * @param AbstractQuery $query + * @return $this */ public function setQuery(AbstractQuery $query) { @@ -43,8 +43,8 @@ public function setQuery(AbstractQuery $query) } /** - * @param AbstractFilter $filter - * @return \Elastica\Param + * @param AbstractFilter $filter + * @return $this */ public function setFilter(AbstractFilter $filter) { @@ -53,11 +53,11 @@ public function setFilter(AbstractFilter $filter) /** * 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 \Elastica\Query\FunctionScore + * @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, $weight = null) { @@ -78,10 +78,10 @@ public function addFunction($functionType, $functionParams, AbstractFilter $filt /** * 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 - * @param float $weight the weight of the function - * @return \Elastica\Query\FunctionScore + * @param Script $script a Script object + * @param AbstractFilter $filter an optional filter to apply to the function + * @param float $weight the weight of the function + * @return $this */ public function addScriptScoreFunction(Script $script, AbstractFilter $filter = null, $weight = null) { @@ -90,16 +90,16 @@ public function addScriptScoreFunction(Script $script, AbstractFilter $filter = /** * 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 \Elastica\Query\FunctionScore + * @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, @@ -165,8 +165,8 @@ public function addRandomScoreFunction($seed, AbstractFilter $filter = null, $we /** * Set an overall boost value for this query - * @param float $boost - * @return \Elastica\Query\FunctionScore + * @param float $boost + * @return $this */ public function setBoost($boost) { @@ -175,8 +175,8 @@ public function setBoost($boost) /** * Restrict the combined boost of the function_score query and its child query - * @param float $maxBoost - * @return \Elastica\Query\FunctionScore + * @param float $maxBoost + * @return $this */ public function setMaxBoost($maxBoost) { @@ -185,8 +185,8 @@ public function setMaxBoost($maxBoost) /** * 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 + * @param string $mode see BOOST_MODE_* constants for valid options. Default is multiply. + * @return $this */ public function setBoostMode($mode) { @@ -195,8 +195,8 @@ public function setBoostMode($mode) /** * 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 + * @param int $seed Set a seed value to return results in the same random order for consistent pagination. + * @return $this */ public function setRandomScore($seed = null) { @@ -210,8 +210,8 @@ public function setRandomScore($seed = null) /** * Set the score method - * @param string $mode see SCORE_MODE_* constants for valid options. Default is multiply. - * @return \Elastica\Query\FunctionScore + * @param string $mode see SCORE_MODE_* constants for valid options. Default is multiply. + * @return $this */ public function setScoreMode($mode) { diff --git a/lib/Elastica/Query/Fuzzy.php b/lib/Elastica/Query/Fuzzy.php index 1bc1c2e3e0..4663ddba83 100644 --- a/lib/Elastica/Query/Fuzzy.php +++ b/lib/Elastica/Query/Fuzzy.php @@ -17,9 +17,8 @@ class Fuzzy extends AbstractQuery /** * 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) { @@ -31,9 +30,9 @@ public function __construct($fieldName = null, $value = null) /** * 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) { @@ -50,9 +49,9 @@ public function setField($fieldName, $value) /** * 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) { @@ -64,7 +63,7 @@ public function setFieldOption($param, $value) $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]]); } /** diff --git a/lib/Elastica/Query/FuzzyLikeThis.php b/lib/Elastica/Query/FuzzyLikeThis.php index 2df245e8d2..bda29d21bf 100644 --- a/lib/Elastica/Query/FuzzyLikeThis.php +++ b/lib/Elastica/Query/FuzzyLikeThis.php @@ -71,8 +71,8 @@ class FuzzyLikeThis extends AbstractQuery /** * Adds field to flt query * - * @param array $fields Field names - * @return \Elastica\Query\FuzzyLikeThis Current object + * @param array $fields Field names + * @return $this */ public function addFields(array $fields) { @@ -84,8 +84,8 @@ public function addFields(array $fields) /** * Set the "like_text" value * - * @param string $text - * @return \Elastica\Query\FuzzyLikeThis This current object + * @param string $text + * @return $this */ public function setLikeText($text) { @@ -98,8 +98,8 @@ public function setLikeText($text) /** * Set the "ignore_tf" value (ignore term frequency) * - * @param bool $ignoreTF - * @return \Elastica\Query\FuzzyLikeThis Current object + * @param bool $ignoreTF + * @return $this */ public function setIgnoreTF($ignoreTF) { @@ -111,8 +111,8 @@ public function setIgnoreTF($ignoreTF) /** * Set the minimum similarity * - * @param int $value - * @return \Elastica\Query\FuzzyLikeThis This current object + * @param int $value + * @return $this */ public function setMinSimilarity($value) { @@ -125,8 +125,8 @@ public function setMinSimilarity($value) /** * Set boost * - * @param float $value Boost value - * @return \Elastica\Query\FuzzyLikeThis Query object + * @param float $value Boost value + * @return $this */ public function setBoost($value) { @@ -138,8 +138,8 @@ public function setBoost($value) /** * Set Prefix Length * - * @param int $value Prefix length - * @return \Elastica\Query\FuzzyLikeThis + * @param int $value Prefix length + * @return $this */ public function setPrefixLength($value) { @@ -151,8 +151,8 @@ public function setPrefixLength($value) /** * Set max_query_terms * - * @param int $value Max query terms value - * @return \Elastica\Query\FuzzyLikeThis + * @param int $value Max query terms value + * @return $this */ public function setMaxQueryTerms($value) { @@ -164,8 +164,8 @@ public function setMaxQueryTerms($value) /** * Set analyzer * - * @param string $text Analyzer text - * @return \Elastica\Query\FuzzyLikeThis + * @param string $text Analyzer text + * @return $this */ public function setAnalyzer($text) { diff --git a/lib/Elastica/Query/HasChild.php b/lib/Elastica/Query/HasChild.php index ed5b26b9d7..e398d368a1 100644 --- a/lib/Elastica/Query/HasChild.php +++ b/lib/Elastica/Query/HasChild.php @@ -30,7 +30,7 @@ public function __construct($query, $type = null) * Sets query object * * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\HasChild + * @return $this */ public function setQuery($query) { @@ -43,8 +43,8 @@ public function setQuery($query) /** * Set type of the parent document * - * @param string $type Parent document type - * @return \Elastica\Query\HasChild Current object + * @param string $type Parent document type + * @return $this */ public function setType($type) { @@ -54,8 +54,8 @@ public function setType($type) /** * Sets the scope * - * @param string $scope Scope - * @return \Elastica\Query\HasChild Current object + * @param string $scope Scope + * @return $this */ public function setScope($scope) { diff --git a/lib/Elastica/Query/HasParent.php b/lib/Elastica/Query/HasParent.php index 6b382a2f7a..8ea282f189 100644 --- a/lib/Elastica/Query/HasParent.php +++ b/lib/Elastica/Query/HasParent.php @@ -29,7 +29,7 @@ public function __construct($query, $type) * Sets query object * * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Filter\HasParent + * @return $this */ public function setQuery($query) { @@ -42,8 +42,8 @@ public function setQuery($query) /** * 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) { @@ -53,8 +53,8 @@ public function setType($type) /** * Sets the scope * - * @param string $scope Scope - * @return \Elastica\Filter\HasParent Current object + * @param string $scope Scope + * @return $this */ public function setScope($scope) { diff --git a/lib/Elastica/Query/Ids.php b/lib/Elastica/Query/Ids.php index 56ee5f76c6..3f693c2a08 100644 --- a/lib/Elastica/Query/Ids.php +++ b/lib/Elastica/Query/Ids.php @@ -38,8 +38,8 @@ public function __construct($type = null, array $ids = array()) /** * Adds one more filter to the and filter * - * @param string $id Adds id to filter - * @return \Elastica\Query\Ids Current object + * @param string $id Adds id to filter + * @return $this */ public function addId($id) { @@ -52,7 +52,7 @@ public function addId($id) * Adds one more type to query * * @param string|\Elastica\Type $type Type name or object - * @return \Elastica\Query\Ids Current object + * @return $this */ public function addType($type) { @@ -72,7 +72,7 @@ public function addType($type) * Set type * * @param string|\Elastica\Type $type Type name or object - * @return \Elastica\Query\Ids Current object + * @return $this */ public function setType($type) { @@ -91,8 +91,8 @@ public function setType($type) /** * 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) { diff --git a/lib/Elastica/Query/Match.php b/lib/Elastica/Query/Match.php index 06548c7df3..e9a1f8ea0f 100644 --- a/lib/Elastica/Query/Match.php +++ b/lib/Elastica/Query/Match.php @@ -19,9 +19,9 @@ class Match extends AbstractQuery /** * Sets a param for the message array * - * @param string $field - * @param mixed $values - * @return \Elastica\Query\Match + * @param string $field + * @param mixed $values + * @return $this */ public function setField($field, $values) { @@ -31,10 +31,10 @@ public function setField($field, $values) /** * 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) { @@ -50,9 +50,9 @@ public function setFieldParam($field, $key, $value) /** * Sets the query string * - * @param string $field - * @param string $query - * @return \Elastica\Query\Match + * @param string $field + * @param string $query + * @return $this */ public function setFieldQuery($field, $query) { @@ -62,9 +62,9 @@ public function setFieldQuery($field, $query) /** * Set field type * - * @param string $field - * @param string $type - * @return \Elastica\Query\Match + * @param string $field + * @param string $type + * @return $this */ public function setFieldType($field, $type) { @@ -74,9 +74,9 @@ public function setFieldType($field, $type) /** * 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) { @@ -86,9 +86,9 @@ public function setFieldOperator($field, $operator) /** * Set field analyzer * - * @param string $field - * @param string $analyzer - * @return \Elastica\Query\Match + * @param string $field + * @param string $analyzer + * @return $this */ public function setFieldAnalyzer($field, $analyzer) { @@ -100,9 +100,9 @@ public function setFieldAnalyzer($field, $analyzer) * * 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) { @@ -112,9 +112,9 @@ public function setFieldBoost($field, $boost = 1.0) /** * Set field minimum should match * - * @param string $field - * @param int|string $minimumShouldMatch - * @return \Elastica\Query\Match + * @param string $field + * @param int|string $minimumShouldMatch + * @return $this * @link Possible values for minimum_should_match http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html */ public function setFieldMinimumShouldMatch($field, $minimumShouldMatch) @@ -125,9 +125,9 @@ public function setFieldMinimumShouldMatch($field, $minimumShouldMatch) /** * Set field fuzziness * - * @param string $field - * @param mixed $fuzziness - * @return \Elastica\Query\Match + * @param string $field + * @param mixed $fuzziness + * @return $this */ public function setFieldFuzziness($field, $fuzziness) { @@ -137,9 +137,9 @@ public function setFieldFuzziness($field, $fuzziness) /** * 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) { @@ -149,9 +149,9 @@ public function setFieldFuzzyRewrite($field, $fuzzyRewrite) /** * Set field prefix length * - * @param string $field - * @param int $prefixLength - * @return \Elastica\Query\Match + * @param string $field + * @param int $prefixLength + * @return $this */ public function setFieldPrefixLength($field, $prefixLength) { @@ -161,9 +161,9 @@ public function setFieldPrefixLength($field, $prefixLength) /** * Set field max expansions * - * @param string $field - * @param int $maxExpansions - * @return \Elastica\Query\Match + * @param string $field + * @param int $maxExpansions + * @return $this */ public function setFieldMaxExpansions($field, $maxExpansions) { @@ -175,9 +175,9 @@ public function setFieldMaxExpansions($field, $maxExpansions) * * 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') { @@ -187,9 +187,9 @@ public function setFieldZeroTermsQuery($field, $zeroTermQuery = 'none') /** * Set cutoff frequency * - * @param string $field - * @param float $cutoffFrequency - * @return \Elastica\Query\Match + * @param string $field + * @param float $cutoffFrequency + * @return $this */ public function setFieldCutoffFrequency($field, $cutoffFrequency) { diff --git a/lib/Elastica/Query/MoreLikeThis.php b/lib/Elastica/Query/MoreLikeThis.php index 44d92bb886..51a49a6411 100644 --- a/lib/Elastica/Query/MoreLikeThis.php +++ b/lib/Elastica/Query/MoreLikeThis.php @@ -15,8 +15,8 @@ class MoreLikeThis extends AbstractQuery /** * Adds field to mlt query * - * @param array $fields Field names - * @return \Elastica\Query\MoreLikeThis Current object + * @param array $fields Field names + * @return $this */ public function setFields(array $fields) { @@ -26,8 +26,8 @@ public function setFields(array $fields) /** * Set the "like_text" value * - * @param string $likeText - * @return \Elastica\Query\MoreLikeThis This current object + * @param string $likeText + * @return $this */ public function setLikeText($likeText) { @@ -39,8 +39,8 @@ public function setLikeText($likeText) /** * Set boost * - * @param float $boost Boost value - * @return \Elastica\Query\MoreLikeThis Query object + * @param float $boost Boost value + * @return $this */ public function setBoost($boost) { @@ -50,8 +50,8 @@ public function setBoost($boost) /** * Set max_query_terms * - * @param int $maxQueryTerms Max query terms value - * @return \Elastica\Query\MoreLikeThis + * @param int $maxQueryTerms Max query terms value + * @return $this */ public function setMaxQueryTerms($maxQueryTerms) { @@ -61,8 +61,8 @@ public function setMaxQueryTerms($maxQueryTerms) /** * Set percent terms to match * - * @param float $percentTermsToMatch Percentage - * @return \Elastica\Query\MoreLikeThis + * @param float $percentTermsToMatch Percentage + * @return $this */ public function setPercentTermsToMatch($percentTermsToMatch) { @@ -72,8 +72,8 @@ public function setPercentTermsToMatch($percentTermsToMatch) /** * Set min term frequency * - * @param int $minTermFreq - * @return \Elastica\Query\MoreLikeThis + * @param int $minTermFreq + * @return $this */ public function setMinTermFrequency($minTermFreq) { @@ -83,8 +83,8 @@ public function setMinTermFrequency($minTermFreq) /** * set min document frequency * - * @param int $minDocFreq - * @return \Elastica\Query\MoreLikeThis + * @param int $minDocFreq + * @return $this */ public function setMinDocFrequency($minDocFreq) { @@ -94,8 +94,8 @@ public function setMinDocFrequency($minDocFreq) /** * set max document frequency * - * @param int $maxDocFreq - * @return \Elastica\Query\MoreLikeThis + * @param int $maxDocFreq + * @return $this */ public function setMaxDocFrequency($maxDocFreq) { @@ -105,8 +105,8 @@ public function setMaxDocFrequency($maxDocFreq) /** * Set min word length * - * @param int $minWordLength - * @return \Elastica\Query\MoreLikeThis + * @param int $minWordLength + * @return $this */ public function setMinWordLength($minWordLength) { @@ -116,8 +116,8 @@ public function setMinWordLength($minWordLength) /** * Set max word length * - * @param int $maxWordLength - * @return \Elastica\Query\MoreLikeThis + * @param int $maxWordLength + * @return $this */ public function setMaxWordLength($maxWordLength) { @@ -127,8 +127,8 @@ public function setMaxWordLength($maxWordLength) /** * Set boost terms * - * @param bool $boostTerms - * @return \Elastica\Query\MoreLikeThis + * @param bool $boostTerms + * @return $this * @link http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query.html */ public function setBoostTerms($boostTerms) @@ -139,8 +139,8 @@ public function setBoostTerms($boostTerms) /** * Set analyzer * - * @param string $analyzer - * @return \Elastica\Query\MoreLikeThis + * @param string $analyzer + * @return $this */ public function setAnalyzer($analyzer) { @@ -152,8 +152,8 @@ public function setAnalyzer($analyzer) /** * Set stop words * - * @param array $stopWords - * @return \Elastica\Query\MoreLikeThis + * @param array $stopWords + * @return $this */ public function setStopWords(array $stopWords) { diff --git a/lib/Elastica/Query/MultiMatch.php b/lib/Elastica/Query/MultiMatch.php index e1de677d3f..c21e59704d 100644 --- a/lib/Elastica/Query/MultiMatch.php +++ b/lib/Elastica/Query/MultiMatch.php @@ -29,8 +29,8 @@ class MultiMatch extends AbstractQuery /** * 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 +40,8 @@ public function setQuery($query = '') /** * 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,8 @@ public function setFields($fields = array()) * * If not set, defaults to true. * - * @param boolean $useDisMax - * @return \Elastica\Query\MultiMatch Current object + * @param boolean $useDisMax + * @return $this */ public function setUseDisMax($useDisMax = true) { @@ -66,8 +66,8 @@ public function setUseDisMax($useDisMax = true) * * 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) { @@ -79,8 +79,8 @@ public function setTieBreaker($tieBreaker = 0.0) * * 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') { @@ -90,8 +90,8 @@ public function setOperator($operator = 'or') /** * Set field minimum should match for Match Query * - * @param int $minimumShouldMatch - * @return \Elastica\Query\Match + * @param int $minimumShouldMatch + * @return $this */ public function setMinimumShouldMatch($minimumShouldMatch) { @@ -103,8 +103,8 @@ public function setMinimumShouldMatch($minimumShouldMatch) * * If not set, default to 'none' * - * @param string $zeroTermQuery - * @return \Elastica\Query\Match + * @param string $zeroTermQuery + * @return $this */ public function setZeroTermsQuery($zeroTermQuery = 'none') { @@ -114,8 +114,8 @@ public function setZeroTermsQuery($zeroTermQuery = 'none') /** * Set cutoff frequency for Match Query * - * @param float $cutoffFrequency - * @return \Elastica\Query\Match + * @param float $cutoffFrequency + * @return $this */ public function setCutoffFrequency($cutoffFrequency) { @@ -125,9 +125,9 @@ public function setCutoffFrequency($cutoffFrequency) /** * Set type * - * @param string $field - * @param string $type - * @return \Elastica\Query\Match + * @param string $field + * @param string $type + * @return $this */ public function setType($type) { @@ -137,8 +137,8 @@ public function setType($type) /** * Set fuzziness * - * @param float $fuzziness - * @return \Elastica\Query\Match + * @param float $fuzziness + * @return $this */ public function setFuzziness($fuzziness) { @@ -148,8 +148,8 @@ public function setFuzziness($fuzziness) /** * Set prefix length * - * @param int $prefixLength - * @return \Elastica\Query\Match + * @param int $prefixLength + * @return $this */ public function setPrefixLength($prefixLength) { @@ -159,8 +159,8 @@ public function setPrefixLength($prefixLength) /** * Set max expansions * - * @param int $maxExpansions - * @return \Elastica\Query\Match + * @param int $maxExpansions + * @return $this */ public function setMaxExpansions($maxExpansions) { @@ -170,8 +170,8 @@ public function setMaxExpansions($maxExpansions) /** * Set analyzer * - * @param string $analyzer - * @return \Elastica\Query\Match + * @param string $analyzer + * @return $this */ public function setAnalyzer($analyzer) { diff --git a/lib/Elastica/Query/Nested.php b/lib/Elastica/Query/Nested.php index d9842f20b8..f223b0d2e3 100644 --- a/lib/Elastica/Query/Nested.php +++ b/lib/Elastica/Query/Nested.php @@ -15,8 +15,8 @@ class Nested extends AbstractQuery /** * Adds field to mlt query * - * @param string $path Nested object path - * @return \Elastica\Query\Nested + * @param string $path Nested object path + * @return $this */ public function setPath($path) { @@ -27,7 +27,7 @@ public function setPath($path) * Sets nested query * * @param \Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\Nested + * @return $this */ public function setQuery(AbstractQuery $query) { @@ -37,8 +37,8 @@ public function setQuery(AbstractQuery $query) /** * Set score method * - * @param string $scoreMode Options: avg, total, max and none. - * @return \Elastica\Query\Nested + * @param string $scoreMode Options: avg, total, max and none. + * @return $this */ public function setScoreMode($scoreMode) { diff --git a/lib/Elastica/Query/Prefix.php b/lib/Elastica/Query/Prefix.php index 5963f7beda..bb3e79f717 100644 --- a/lib/Elastica/Query/Prefix.php +++ b/lib/Elastica/Query/Prefix.php @@ -25,8 +25,8 @@ public function __construct(array $prefix = array()) * 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) { @@ -36,10 +36,10 @@ public function setRawPrefix(array $prefix) /** * 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) - * @return \Elastica\Query\Prefix Current object + * @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 $this */ public function setPrefix($key, $value, $boost = 1.0) { diff --git a/lib/Elastica/Query/QueryString.php b/lib/Elastica/Query/QueryString.php index a24a022ce2..f004a97131 100644 --- a/lib/Elastica/Query/QueryString.php +++ b/lib/Elastica/Query/QueryString.php @@ -34,9 +34,10 @@ public function __construct($queryString = '') /** * Sets a new query string for the object * - * @param string $query Query string - * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Query\QueryString Current object + * @throws \Elastica\Exception\InvalidException If given parameter is not a string + * + * @param string $query Query string + * @return $this */ public function setQuery($query = '') { @@ -52,8 +53,8 @@ public function setQuery($query = '') * * 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) { @@ -65,8 +66,8 @@ public function setDefaultField($field) * * 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) { @@ -76,8 +77,8 @@ public function setDefaultOperator($operator) /** * 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) { @@ -89,8 +90,8 @@ public function setAnalyzer($analyzer) * * 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) { @@ -102,8 +103,8 @@ public function setAllowLeadingWildcard($allow = true) * * If not set, defaults to true. * - * @param bool $lowercase - * @return \Elastica\Query\QueryString Current object + * @param bool $lowercase + * @return $this */ public function setLowercaseExpandedTerms($lowercase = true) { @@ -115,8 +116,8 @@ public function setLowercaseExpandedTerms($lowercase = true) * * 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) { @@ -128,8 +129,8 @@ public function setEnablePositionIncrements($enabled = true) * * 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) { @@ -141,8 +142,8 @@ public function setFuzzyPrefixLength($length = 0) * * 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) { @@ -155,8 +156,8 @@ public function setFuzzyMinSim($minSim = 0.5) * 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) { @@ -168,8 +169,8 @@ public function setPhraseSlop($phraseSlop = 0) * * 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) { @@ -181,8 +182,8 @@ public function setBoost($boost = 1.0) * * 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) { @@ -194,8 +195,8 @@ public function setAnalyzeWildcard($analyze = true) * * 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) { @@ -203,13 +204,12 @@ public function setAutoGeneratePhraseQueries($autoGenerate = true) } /** - * Sets the fields + * Sets the fields. If no fields are set, _all is chosen * - * 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 + * @param array $fields Fields + * @return $this */ public function setFields(array $fields) { @@ -223,8 +223,8 @@ public function setFields(array $fields) /** * 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) { @@ -236,8 +236,8 @@ public function setUseDisMax($value = true) * * 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) { @@ -247,8 +247,8 @@ public function setTieBreaker($tieBreaker = 0) /** * 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 = "") { diff --git a/lib/Elastica/Query/Range.php b/lib/Elastica/Query/Range.php index 2bf59ea607..361d1e58c6 100644 --- a/lib/Elastica/Query/Range.php +++ b/lib/Elastica/Query/Range.php @@ -28,9 +28,9 @@ public function __construct($fieldName = null, array $args = array()) /** * Adds a range field to the query * - * @param string $fieldName Field name - * @param array $args Field arguments - * @return \Elastica\Query\Range Current object + * @param string $fieldName Field name + * @param array $args Field arguments + * @return $this */ public function addField($fieldName, array $args) { diff --git a/lib/Elastica/Query/Regexp.php b/lib/Elastica/Query/Regexp.php index a7258373d8..835621d1d3 100644 --- a/lib/Elastica/Query/Regexp.php +++ b/lib/Elastica/Query/Regexp.php @@ -29,10 +29,10 @@ public function __construct($key = '', $value = null, $boost = 1.0) /** * Sets the query expression for a key with its boost value * - * @param string $key - * @param string $value - * @param float $boost - * @return \Elastica\Query\Regexp + * @param string $key + * @param string $value + * @param float $boost + * @return $this */ public function setValue($key, $value, $boost = 1.0) { diff --git a/lib/Elastica/Query/Simple.php b/lib/Elastica/Query/Simple.php index 75de2d2723..fa408189f0 100644 --- a/lib/Elastica/Query/Simple.php +++ b/lib/Elastica/Query/Simple.php @@ -32,8 +32,8 @@ public function __construct(array $query) /** * Sets new query array * - * @param array $query Query array - * @return \Elastica\Query\Simple Current object + * @param array $query Query array + * @return $this */ public function setQuery(array $query) { diff --git a/lib/Elastica/Query/SimpleQueryString.php b/lib/Elastica/Query/SimpleQueryString.php index 0a51f2205a..ebf1e34a0a 100644 --- a/lib/Elastica/Query/SimpleQueryString.php +++ b/lib/Elastica/Query/SimpleQueryString.php @@ -26,8 +26,8 @@ public function __construct($query, array $fields = array()) /** * Set the querystring for this query - * @param string $query see ES documentation for querystring syntax - * @return \Elastica\Query\SimpleQueryString + * @param string $query see ES documentation for querystring syntax + * @return $this */ public function setQuery($query) { @@ -35,8 +35,8 @@ public function setQuery($query) } /** - * @param string[] $fields the fields on which to perform this query. Defaults to index.query.default_field. - * @return \Elastica\Query\SimpleQueryString + * @param string[] $fields the fields on which to perform this query. Defaults to index.query.default_field. + * @return $this */ public function setFields(array $fields) { @@ -45,8 +45,8 @@ public function setFields(array $fields) /** * 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 + * @param string $operator see OPERATOR_* constants for options + * @return $this */ public function setDefaultOperator($operator) { @@ -55,8 +55,8 @@ public function setDefaultOperator($operator) /** * Set the analyzer used to analyze each term of the query - * @param string $analyzer - * @return \Elastica\Query\SimpleQueryString + * @param string $analyzer + * @return $this */ public function setAnalyzer($analyzer) { diff --git a/lib/Elastica/Query/Term.php b/lib/Elastica/Query/Term.php index 12fc350d8c..f16f6f2a7d 100644 --- a/lib/Elastica/Query/Term.php +++ b/lib/Elastica/Query/Term.php @@ -26,8 +26,8 @@ public function __construct(array $term = array()) * 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) { @@ -37,10 +37,10 @@ public function setRawTerm(array $term) /** * 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) - * @return \Elastica\Query\Term Current object + * @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 $this */ public function setTerm($key, $value, $boost = 1.0) { diff --git a/lib/Elastica/Query/Terms.php b/lib/Elastica/Query/Terms.php index 96167e89ed..3166691632 100644 --- a/lib/Elastica/Query/Terms.php +++ b/lib/Elastica/Query/Terms.php @@ -49,9 +49,9 @@ public function __construct($key = '', array $terms = array()) /** * Sets key and terms for the query * - * @param string $key Terms key - * @param array $terms Terms for the query. - * @return \Elastica\Query\Terms + * @param string $key Terms key + * @param array $terms Terms for the query. + * @return $this */ public function setTerms($key, array $terms) { @@ -64,8 +64,8 @@ public function setTerms($key, array $terms) /** * 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) { @@ -77,8 +77,8 @@ public function addTerm($term) /** * Sets the minimum matching values * - * @param int $minimum Minimum value - * @return \Elastica\Query\Terms + * @param int $minimum Minimum value + * @return $this */ public function setMinimumMatch($minimum) { @@ -89,8 +89,9 @@ public function setMinimumMatch($minimum) * 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/lib/Elastica/Query/TopChildren.php b/lib/Elastica/Query/TopChildren.php index 33c452a136..82cbaa2f15 100644 --- a/lib/Elastica/Query/TopChildren.php +++ b/lib/Elastica/Query/TopChildren.php @@ -30,7 +30,7 @@ public function __construct($query, $type = null) * Sets query object * * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\TopChildren + * @return $this */ public function setQuery($query) { @@ -43,8 +43,8 @@ public function setQuery($query) /** * Set type of the parent document * - * @param string $type Parent document type - * @return \Elastica\Query\TopChildren Current object + * @param string $type Parent document type + * @return $this */ public function setType($type) { diff --git a/lib/Elastica/Query/Wildcard.php b/lib/Elastica/Query/Wildcard.php index 218a2663ca..f807956706 100644 --- a/lib/Elastica/Query/Wildcard.php +++ b/lib/Elastica/Query/Wildcard.php @@ -29,10 +29,10 @@ public function __construct($key = '', $value = null, $boost = 1.0) /** * Sets the query expression for a key with its boost value * - * @param string $key - * @param string $value - * @param float $boost - * @return \Elastica\Query\Wildcard + * @param string $key + * @param string $value + * @param float $boost + * @return $this */ public function setValue($key, $value, $boost = 1.0) { diff --git a/lib/Elastica/QueryBuilder.php b/lib/Elastica/QueryBuilder.php index 275d6db5d5..276483570c 100644 --- a/lib/Elastica/QueryBuilder.php +++ b/lib/Elastica/QueryBuilder.php @@ -44,10 +44,11 @@ public function __construct(Version $version = null) /** * Returns Facade for custom DSL object * + * @throws QueryBuilderException + * * @param $dsl - * @param array $arguments + * @param array $arguments * @return Facade - * @throws QueryBuilderException */ public function __call($dsl, array $arguments) { diff --git a/lib/Elastica/QueryBuilder/Facade.php b/lib/Elastica/QueryBuilder/Facade.php index 4eeacaa6c3..f20ed80bc6 100644 --- a/lib/Elastica/QueryBuilder/Facade.php +++ b/lib/Elastica/QueryBuilder/Facade.php @@ -37,10 +37,11 @@ public function __construct(DSL $dsl, Version $version) /** * Executes DSL methods * - * @param $name - * @param array $arguments - * @return mixed * @throws QueryBuilderException + * + * @param string $name + * @param array $arguments + * @return mixed */ public function __call($name, array $arguments) { diff --git a/lib/Elastica/Request.php b/lib/Elastica/Request.php index c9f3e95867..6bbec6f35c 100644 --- a/lib/Elastica/Request.php +++ b/lib/Elastica/Request.php @@ -49,8 +49,8 @@ public function __construct($path, $method = self::GET, $data = array(), array $ /** * Sets the request method. Use one of the for consts * - * @param string $method Request method - * @return \Elastica\Request Current object + * @param string $method Request method + * @return $this */ public function setMethod($method) { @@ -70,8 +70,8 @@ public function getMethod() /** * Sets the request data * - * @param array $data Request data - * @return \Elastica\Request + * @param array $data Request data + * @return $this */ public function setData($data) { @@ -91,8 +91,8 @@ public function getData() /** * Sets the request path * - * @param string $path Request path - * @return \Elastica\Request Current object + * @param string $path Request path + * @return $this */ public function setPath($path) { @@ -120,8 +120,8 @@ public function getQuery() } /** - * @param array $query - * @return \Elastica\Request + * @param array $query + * @return $this */ public function setQuery(array $query = array()) { @@ -130,7 +130,7 @@ public function setQuery(array $query = array()) /** * @param \Elastica\Connection $connection - * @return \Elastica\Request + * @return $this */ public function setConnection(Connection $connection) { @@ -142,7 +142,8 @@ public function setConnection(Connection $connection) /** * Return Connection Object * - * @throws Exception\InvalidException + * @throws Exception\InvalidException If no valid connection was setted + * * @return \Elastica\Connection */ public function getConnection() diff --git a/lib/Elastica/Rescore/AbstractRescore.php b/lib/Elastica/Rescore/AbstractRescore.php index f402c23ddc..85d7ec31f4 100644 --- a/lib/Elastica/Rescore/AbstractRescore.php +++ b/lib/Elastica/Rescore/AbstractRescore.php @@ -27,8 +27,8 @@ protected function _getBaseName() /** * Sets window_size * - * @param int $size - * @return \Elastica\Rescore + * @param int $size + * @return $this */ public function setWindowSize($size) { diff --git a/lib/Elastica/Rescore/Query.php b/lib/Elastica/Rescore/Query.php index 8dff2f6901..e741a922bb 100644 --- a/lib/Elastica/Rescore/Query.php +++ b/lib/Elastica/Rescore/Query.php @@ -47,7 +47,7 @@ public function toArray() * Sets rescoreQuery object * * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query - * @return \Elastica\Query\Rescore + * @return $this */ public function setRescoreQuery($rescoreQuery) { @@ -63,8 +63,8 @@ public function setRescoreQuery($rescoreQuery) /** * Sets query_weight * - * @param float $weight - * @return \Elastica\Query\Rescore + * @param float $weight + * @return $this */ public function setQueryWeight($weight) { @@ -77,8 +77,8 @@ public function setQueryWeight($weight) /** * Sets rescore_query_weight * - * @param float $size - * @return \Elastica\Query\Rescore + * @param float $size + * @return $this */ public function setRescoreQueryWeight($weight) { diff --git a/lib/Elastica/Response.php b/lib/Elastica/Response.php index 4dc0f3ac79..c3c9b9faab 100644 --- a/lib/Elastica/Response.php +++ b/lib/Elastica/Response.php @@ -220,8 +220,8 @@ public function getTransferInfo() * Sets the transfer info of the curl request. This function is called * from the \Elastica\Client::_callService . * - * @param array $transferInfo The curl transfer information. - * @return \Elastica\Response Current object + * @param array $transferInfo The curl transfer information. + * @return $this */ public function setTransferInfo(array $transferInfo) { @@ -243,8 +243,8 @@ public function getQueryTime() /** * Sets the query time * - * @param float $queryTime Query time - * @return \Elastica\Response Current object + * @param float $queryTime Query time + * @return $this */ public function setQueryTime($queryTime) { @@ -257,7 +257,8 @@ public function setQueryTime($queryTime) * Time request took * * @throws \Elastica\Exception\NotFoundException - * @return int Time request took + * + * @return int Time request took */ public function getEngineTime() { @@ -274,6 +275,7 @@ public function getEngineTime() * Get the _shard statistics for the response * * @throws \Elastica\Exception\NotFoundException + * * @return array */ public function getShardsStatistics() @@ -291,6 +293,7 @@ public function getShardsStatistics() * Get the _scroll value for the response * * @throws \Elastica\Exception\NotFoundException + * * @return string */ public function getScrollId() diff --git a/lib/Elastica/ResultSet.php b/lib/Elastica/ResultSet.php index e2d7d65100..31291dbcaa 100644 --- a/lib/Elastica/ResultSet.php +++ b/lib/Elastica/ResultSet.php @@ -200,9 +200,11 @@ public function getAggregations() /** * Retrieve a specific aggregation from this result set - * @param string $name the name of the desired aggregation - * @return array + * * @throws Exception\InvalidException if an aggregation by the given name cannot be found + * + * @param string $name the name of the desired aggregation + * @return array */ public function getAggregation($name) { @@ -371,9 +373,9 @@ public function offsetExists($offset) /** * Offset to retrieve * @link http://php.net/manual/en/arrayaccess.offsetget.php + * @throws Exception\InvalidException If offset doesn't exist * - * @param integer $offset - * @throws Exception\InvalidException + * @param integer $offset * @return Result|null */ public function offsetGet($offset) @@ -388,10 +390,10 @@ public function offsetGet($offset) /** * Offset to set * @link http://php.net/manual/en/arrayaccess.offsetset.php - * - * @param integer $offset - * @param Result $value * @throws Exception\InvalidException + * + * @param integer $offset + * @param Result $value */ public function offsetSet($offset, $value) { diff --git a/lib/Elastica/ScanAndScroll.php b/lib/Elastica/ScanAndScroll.php index 65dd7b5085..88330549cc 100644 --- a/lib/Elastica/ScanAndScroll.php +++ b/lib/Elastica/ScanAndScroll.php @@ -110,6 +110,7 @@ public function valid() * Start the initial scan search * @link http://php.net/manual/en/iterator.rewind.php * @throws \Elastica\Exception\InvalidException + * * @return void */ public function rewind() @@ -129,7 +130,6 @@ public function rewind() /** * Perform next scroll search * @throws \Elastica\Exception\InvalidException - * @return void */ protected function _scroll() { diff --git a/lib/Elastica/Script.php b/lib/Elastica/Script.php index a20de57008..e559b1c1ed 100644 --- a/lib/Elastica/Script.php +++ b/lib/Elastica/Script.php @@ -38,9 +38,11 @@ class Script extends AbstractUpdateAction public function __construct($script, array $params = null, $lang = null, $id = null) { $this->setScript($script); + if ($params) { $this->setParams($params); } + if ($lang) { $this->setLang($lang); } @@ -51,11 +53,14 @@ public function __construct($script, array $params = null, $lang = null, $id = n } /** - * @param string $lang + * @param string $lang + * @return $this */ public function setLang($lang) { $this->_lang = $lang; + + return $this; } /** @@ -67,11 +72,14 @@ public function getLang() } /** - * @param string $script + * @param string $script + * @return $this */ public function setScript($script) { $this->_script = $script; + + return $this; } /** @@ -83,9 +91,10 @@ public function getScript() } /** - * @param string|array|\Elastica\Script $data * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Script + * + * @param string|array|\Elastica\Script $data + * @return self */ public static function create($data) { @@ -103,9 +112,10 @@ public static function create($data) } /** - * @param array $data * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Script + * + * @param array $data + * @return self */ protected static function _createFromArray(array $data) { @@ -118,6 +128,7 @@ protected static function _createFromArray(array $data) if (isset($data['lang'])) { $script->setLang($data['lang']); } + if (isset($data['params'])) { if (!is_array($data['params'])) { throw new InvalidException("\$data['params'] should be array"); @@ -136,9 +147,11 @@ public function toArray() $array = array( 'script' => $this->_script, ); + if (!empty($this->_params)) { $array['params'] = $this->_params; } + if ($this->_lang) { $array['lang'] = $this->_lang; } diff --git a/lib/Elastica/ScriptFields.php b/lib/Elastica/ScriptFields.php index 3e01638d03..9018433e99 100644 --- a/lib/Elastica/ScriptFields.php +++ b/lib/Elastica/ScriptFields.php @@ -25,10 +25,11 @@ public function __construct(array $scripts = array()) } /** - * @param string $name Name of the Script field - * @param \Elastica\Script $script * @throws \Elastica\Exception\InvalidException - * @return \Elastica\ScriptFields + * + * @param string $name Name of the Script field + * @param \Elastica\Script $script + * @return $this */ public function addScript($name, Script $script) { @@ -42,7 +43,7 @@ public function addScript($name, Script $script) /** * @param \Elastica\Script[]|array $scripts Associative array of string => Elastica\Script - * @return \Elastica\ScriptFields + * @return $this */ public function setScripts(array $scripts) { diff --git a/lib/Elastica/Search.php b/lib/Elastica/Search.php index a89a2f7eea..aea6a2de63 100644 --- a/lib/Elastica/Search.php +++ b/lib/Elastica/Search.php @@ -83,9 +83,10 @@ public function __construct(Client $client) /** * Adds a index to the list * - * @param \Elastica\Index|string $index Index object or string * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Search Current object + * + * @param \Elastica\Index|string $index Index object or string + * @return $this */ public function addIndex($index) { @@ -105,8 +106,8 @@ public function addIndex($index) /** * Add array of indices at once * - * @param array $indices - * @return \Elastica\Search + * @param array $indices + * @return $this */ public function addIndices(array $indices = array()) { @@ -120,9 +121,10 @@ public function addIndices(array $indices = array()) /** * Adds a type to the current search * - * @param \Elastica\Type|string $type Type name or object - * @return \Elastica\Search Search object * @throws \Elastica\Exception\InvalidException + * + * @param \Elastica\Type|string $type Type name or object + * @return $this */ public function addType($type) { @@ -142,8 +144,8 @@ public function addType($type) /** * Add array of types * - * @param array $types - * @return \Elastica\Search + * @param array $types + * @return $this */ public function addTypes(array $types = array()) { @@ -156,7 +158,7 @@ public function addTypes(array $types = array()) /** * @param string|array|\Elastica\Query|\Elastica\Suggest|\Elastica\Query\AbstractQuery|\Elastica\Filter\AbstractFilter $query| - * @return \Elastica\Search + * @return $this */ public function setQuery($query) { @@ -166,9 +168,9 @@ public function setQuery($query) } /** - * @param string $key - * @param mixed $value - * @return \Elastica\Search + * @param string $key + * @param mixed $value + * @return $this */ public function setOption($key, $value) { @@ -180,8 +182,8 @@ public function setOption($key, $value) } /** - * @param array $options - * @return \Elastica\Search + * @param array $options + * @return $this */ public function setOptions(array $options) { @@ -195,7 +197,7 @@ public function setOptions(array $options) } /** - * @return \Elastica\Search + * @return $this */ public function clearOptions() { @@ -205,9 +207,9 @@ public function clearOptions() } /** - * @param string $key - * @param mixed $value - * @return \Elastica\Search + * @param string $key + * @param mixed $value + * @return $this */ public function addOption($key, $value) { @@ -232,9 +234,10 @@ public function hasOption($key) } /** - * @param string $key - * @return mixed * @throws \Elastica\Exception\InvalidException + * + * @param string $key + * @return mixed */ public function getOption($key) { @@ -254,9 +257,10 @@ public function getOptions() } /** - * @param string $key - * @return bool * @throws \Elastica\Exception\InvalidException + * + * @param string $key + * @return bool */ protected function _validateOption($key) { @@ -366,7 +370,7 @@ public function getQuery() * Creates new search object * * @param \Elastica\SearchableInterface $searchObject - * @return \Elastica\Search + * @return Search */ public static function create(SearchableInterface $searchObject) { @@ -408,9 +412,10 @@ public function getPath() /** * Search in the set indices, types * - * @param mixed $query - * @param int|array $options OPTIONAL Limit or associative array of options (option=>value) * @throws \Elastica\Exception\InvalidException + * + * @param mixed $query + * @param int|array $options OPTIONAL Limit or associative array of options (option=>value) * @return \Elastica\ResultSet */ public function search($query = '', $options = null) @@ -467,7 +472,7 @@ public function count($query = '', $fullResult = false) /** * @param array|int $options * @param string|array|\Elastica\Query $query - * @return \Elastica\Search + * @return $this */ public function setOptionsAndQuery($options = null, $query = '') { @@ -494,7 +499,7 @@ public function setOptionsAndQuery($options = null, $query = '') /** * @param Suggest $suggest - * @return Search + * @return $this */ public function setSuggest(Suggest $suggest) { diff --git a/lib/Elastica/Snapshot.php b/lib/Elastica/Snapshot.php index 10da5b459d..e70334f5db 100644 --- a/lib/Elastica/Snapshot.php +++ b/lib/Elastica/Snapshot.php @@ -44,9 +44,11 @@ public function registerRepository($name, $type, $settings = array()) /** * Retrieve a repository record by name - * @param string $name the name of the desired repository + * * @throws Exception\ResponseException * @throws Exception\NotFoundException + * + * @param string $name the name of the desired repository * @return array */ public function getRepository($name) @@ -88,10 +90,12 @@ public function createSnapshot($repository, $name, $options = array(), $waitForC /** * Retrieve data regarding a specific snapshot - * @param string $repository the name of the repository from which to retrieve the snapshot - * @param string $name the name of the desired snapshot + * * @throws Exception\ResponseException * @throws Exception\NotFoundException + * + * @param string $repository the name of the repository from which to retrieve the snapshot + * @param string $name the name of the desired snapshot * @return array */ public function getSnapshot($repository, $name) diff --git a/lib/Elastica/Suggest.php b/lib/Elastica/Suggest.php index 2fa55da895..a3aa4dd5ae 100644 --- a/lib/Elastica/Suggest.php +++ b/lib/Elastica/Suggest.php @@ -24,8 +24,8 @@ public function __construct(AbstractSuggest $suggestion = null) /** * Set the global text for this suggester - * @param string $text - * @return \Elastica\Suggest + * @param string $text + * @return $this */ public function setGlobalText($text) { @@ -34,8 +34,8 @@ public function setGlobalText($text) /** * Add a suggestion to this suggest clause - * @param AbstractSuggest $suggestion - * @return \Elastica\Suggest + * @param AbstractSuggest $suggestion + * @return $this */ public function addSuggestion(AbstractSuggest $suggestion) { @@ -43,9 +43,10 @@ public function addSuggestion(AbstractSuggest $suggestion) } /** - * @param Suggest|AbstractSuggest $suggestion - * @return \Elastica\Suggest * @throws Exception\NotImplementedException + * + * @param Suggest|AbstractSuggest $suggestion + * @return self */ public static function create($suggestion) { diff --git a/lib/Elastica/Suggest/AbstractSuggest.php b/lib/Elastica/Suggest/AbstractSuggest.php index c636ae75f4..61aedcb047 100644 --- a/lib/Elastica/Suggest/AbstractSuggest.php +++ b/lib/Elastica/Suggest/AbstractSuggest.php @@ -32,8 +32,8 @@ public function __construct($name, $field) /** * Suggest text must be set either globally or per suggestion - * @param string $text - * @return \Elastica\Suggest\AbstractSuggest + * @param string $text + * @return $this */ public function setText($text) { @@ -43,8 +43,8 @@ public function setText($text) } /** - * @param string $field - * @return \Elastica\Suggest\AbstractSuggest + * @param string $field + * @return $this */ public function setField($field) { @@ -52,8 +52,8 @@ public function setField($field) } /** - * @param int $size - * @return \Elastica\Suggest\AbstractSuggest + * @param int $size + * @return $this */ public function setSize($size) { @@ -61,8 +61,8 @@ public function setSize($size) } /** - * @param int $size maximum number of suggestions to be retrieved from each shard - * @return \Elastica\Suggest\AbstractSuggest + * @param int $size maximum number of suggestions to be retrieved from each shard + * @return $this */ public function setShardSize($size) { diff --git a/lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php b/lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php index ccb85b2db2..b6ff1aca86 100644 --- a/lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php +++ b/lib/Elastica/Suggest/CandidateGenerator/DirectGenerator.php @@ -23,8 +23,8 @@ public function __construct($field) /** * Set the field name from which to fetch candidate suggestions - * @param string $field - * @return DirectGenerator + * @param string $field + * @return $this */ public function setField($field) { @@ -33,8 +33,8 @@ public function setField($field) /** * Set the maximum corrections to be returned per suggest text token - * @param int $size - * @return DirectGenerator + * @param int $size + * @return $this */ public function setSize($size) { @@ -42,8 +42,8 @@ public function setSize($size) } /** - * @param string $mode see SUGGEST_MODE_* constants for options - * @return DirectGenerator + * @param string $mode see SUGGEST_MODE_* constants for options + * @return $this */ public function setSuggestMode($mode) { @@ -51,8 +51,8 @@ public function setSuggestMode($mode) } /** - * @param int $max can only be a value between 1 and 2. Defaults to 2. - * @return DirectGenerator + * @param int $max can only be a value between 1 and 2. Defaults to 2. + * @return $this */ public function setMaxEdits($max) { @@ -60,8 +60,8 @@ public function setMaxEdits($max) } /** - * @param int $length defaults to 1 - * @return DirectGenerator + * @param int $length defaults to 1 + * @return $this */ public function setPrefixLength($length) { @@ -69,8 +69,8 @@ public function setPrefixLength($length) } /** - * @param int $min defaults to 4 - * @return DirectGenerator + * @param int $min defaults to 4 + * @return $this */ public function setMinWordLength($min) { @@ -78,8 +78,8 @@ public function setMinWordLength($min) } /** - * @param int $max - * @return DirectGenerator + * @param int $max + * @return $this */ public function setMaxInspections($max) { @@ -87,8 +87,8 @@ public function setMaxInspections($max) } /** - * @param float $min - * @return DirectGenerator + * @param float $min + * @return $this */ public function setMinDocFrequency($min) { @@ -96,8 +96,8 @@ public function setMinDocFrequency($min) } /** - * @param float $max - * @return DirectGenerator + * @param float $max + * @return $this */ public function setMaxTermFrequency($max) { @@ -106,8 +106,8 @@ public function setMaxTermFrequency($max) /** * Set an analyzer to be applied to the original token prior to candidate generation - * @param string $pre an analyzer - * @return DirectGenerator + * @param string $pre an analyzer + * @return $this */ public function setPreFilter($pre) { @@ -116,8 +116,8 @@ public function setPreFilter($pre) /** * Set an analyzer to be applied to generated tokens before they are passed to the phrase scorer - * @param string $post - * @return DirectGenerator + * @param string $post + * @return $this */ public function setPostFilter($post) { diff --git a/lib/Elastica/Suggest/Phrase.php b/lib/Elastica/Suggest/Phrase.php index f5ed0dd8d2..3842841e59 100644 --- a/lib/Elastica/Suggest/Phrase.php +++ b/lib/Elastica/Suggest/Phrase.php @@ -12,8 +12,8 @@ class Phrase extends AbstractSuggest { /** - * @param string $analyzer - * @return \Elastica\Suggest\Phrase + * @param string $analyzer + * @return $this */ public function setAnalyzer($analyzer) { @@ -22,8 +22,8 @@ public function setAnalyzer($analyzer) /** * Set the max size of the n-grams (shingles) in the field - * @param int $size - * @return \Elastica\Suggest\Phrase + * @param int $size + * @return $this */ public function setGramSize($size) { @@ -32,8 +32,8 @@ public function setGramSize($size) /** * Set the likelihood of a term being misspelled even if the term exists in the dictionary - * @param float $likelihood Defaults to 0.95, meaning 5% of the words are misspelled. - * @return \Elastica\Suggest\Phrase + * @param float $likelihood Defaults to 0.95, meaning 5% of the words are misspelled. + * @return $this */ public function setRealWordErrorLikelihood($likelihood) { @@ -43,8 +43,8 @@ public function setRealWordErrorLikelihood($likelihood) /** * Set the factor applied to the input phrases score to be used as a threshold for other suggestion candidates. * Only candidates which score higher than this threshold will be included in the result. - * @param float $confidence Defaults to 1.0. - * @return \Elastica\Suggest\Phrase + * @param float $confidence Defaults to 1.0. + * @return $this */ public function setConfidence($confidence) { @@ -53,8 +53,8 @@ public function setConfidence($confidence) /** * Set the maximum percentage of the terms considered to be misspellings in order to form a correction - * @param float $max - * @return \Elastica\Suggest\Phrase + * @param float $max + * @return $this */ public function setMaxErrors($max) { @@ -62,8 +62,8 @@ public function setMaxErrors($max) } /** - * @param string $separator - * @return \Elastica\Param + * @param string $separator + * @return $this */ public function setSeparator($separator) { @@ -72,9 +72,9 @@ public function setSeparator($separator) /** * Set suggestion highlighting - * @param string $preTag - * @param string $postTag - * @return \Elastica\Suggest\Phrase + * @param string $preTag + * @param string $postTag + * @return $this */ public function setHighlight($preTag, $postTag) { @@ -85,8 +85,8 @@ public function setHighlight($preTag, $postTag) } /** - * @param float $discount - * @return \Elastica\Suggest\Phrase + * @param float $discount + * @return $this */ public function setStupidBackoffSmoothing($discount = 0.4) { @@ -96,8 +96,8 @@ public function setStupidBackoffSmoothing($discount = 0.4) } /** - * @param float $alpha - * @return \Elastica\Suggest\Phrase + * @param float $alpha + * @return $this */ public function setLaplaceSmoothing($alpha = 0.5) { @@ -107,10 +107,10 @@ public function setLaplaceSmoothing($alpha = 0.5) } /** - * @param float $trigramLambda - * @param float $bigramLambda - * @param float $unigramLambda - * @return \Elastica\Suggest\Phrase + * @param float $trigramLambda + * @param float $bigramLambda + * @param float $unigramLambda + * @return $this */ public function setLinearInterpolationSmoothing($trigramLambda, $bigramLambda, $unigramLambda) { @@ -122,9 +122,9 @@ public function setLinearInterpolationSmoothing($trigramLambda, $bigramLambda, $ } /** - * @param string $model the name of the smoothing model - * @param array $params - * @return \Elastica\Suggest\Phrase + * @param string $model the name of the smoothing model + * @param array $params + * @return $this */ public function setSmoothingModel($model, array $params) { @@ -135,7 +135,7 @@ public function setSmoothingModel($model, array $params) /** * @param AbstractCandidateGenerator $generator - * @return \Elastica\Suggest\Phrase + * @return $this */ public function addCandidateGenerator(AbstractCandidateGenerator $generator) { diff --git a/lib/Elastica/Suggest/Term.php b/lib/Elastica/Suggest/Term.php index dd27126b50..b17c41e41d 100644 --- a/lib/Elastica/Suggest/Term.php +++ b/lib/Elastica/Suggest/Term.php @@ -17,8 +17,8 @@ class Term extends AbstractSuggest const SUGGEST_MODE_ALWAYS = 'always'; /** - * @param string $analyzer - * @return \Elastica\Suggest\Term + * @param string $analyzer + * @return $this */ public function setAnalyzer($analyzer) { @@ -26,8 +26,8 @@ public function setAnalyzer($analyzer) } /** - * @param string $sort see SORT_* constants for options - * @return \Elastica\Suggest\Term + * @param string $sort see SORT_* constants for options + * @return $this */ public function setSort($sort) { @@ -35,8 +35,8 @@ public function setSort($sort) } /** - * @param string $mode see SUGGEST_MODE_* constants for options - * @return \Elastica\Suggest\Term + * @param string $mode see SUGGEST_MODE_* constants for options + * @return $this */ public function setSuggestMode($mode) { @@ -45,8 +45,8 @@ public function setSuggestMode($mode) /** * If true, suggest terms will be lower cased after text analysis - * @param bool $lowercase - * @return \Elastica\Suggest\Term + * @param bool $lowercase + * @return $this */ public function setLowercaseTerms($lowercase = true) { @@ -55,8 +55,8 @@ public function setLowercaseTerms($lowercase = true) /** * Set the maximum edit distance candidate suggestions can have in order to be considered as a suggestion - * @param int $max Either 1 or 2. Any other value will result in an error. - * @return \Elastica\Suggest\Term + * @param int $max Either 1 or 2. Any other value will result in an error. + * @return $this */ public function setMaxEdits($max) { @@ -65,8 +65,8 @@ public function setMaxEdits($max) /** * The number of minimum prefix characters that must match in order to be a suggestion candidate - * @param int $length Defaults to 1. - * @return \Elastica\Suggest\Term + * @param int $length Defaults to 1. + * @return $this */ public function setPrefixLength($length) { @@ -75,8 +75,8 @@ public function setPrefixLength($length) /** * The minimum length a suggest text term must have in order to be included. - * @param int $length Defaults to 4. - * @return \Elastica\Suggest\Term + * @param int $length Defaults to 4. + * @return $this */ public function setMinWordLength($length) { @@ -84,8 +84,8 @@ public function setMinWordLength($length) } /** - * @param int $max Defaults to 5. - * @return \Elastica\Suggest\Term + * @param int $max Defaults to 5. + * @return $this */ public function setMaxInspections($max) { @@ -94,8 +94,8 @@ public function setMaxInspections($max) /** * Set the minimum number of documents in which a suggestion should appear - * @param int|float $min Defaults to 0. If the value is greater than 1, it must be a whole number. - * @return \Elastica\Suggest\Term + * @param int|float $min Defaults to 0. If the value is greater than 1, it must be a whole number. + * @return $this */ public function setMinDocFrequency($min) { @@ -104,8 +104,8 @@ public function setMinDocFrequency($min) /** * Set the maximum number of documents in which a suggest text token can exist in order to be included - * @param float $max - * @return \Elastica\Suggest\Term + * @param float $max + * @return $this */ public function setMaxTermFrequency($max) { diff --git a/lib/Elastica/Transport/AbstractTransport.php b/lib/Elastica/Transport/AbstractTransport.php index c58c350a90..de754928d2 100644 --- a/lib/Elastica/Transport/AbstractTransport.php +++ b/lib/Elastica/Transport/AbstractTransport.php @@ -42,11 +42,14 @@ public function getConnection() } /** - * @param \Elastica\Connection $connection Connection object + * @param \Elastica\Connection $connection Connection object + * @return $this */ public function setConnection(Connection $connection) { $this->_connection = $connection; + + return $this; } /** @@ -68,10 +71,11 @@ abstract public function exec(Request $request, array $params); * * array: An array with a "type" key which must be set to one of the two options. All other * keys in the array will be set as parameters in the transport instance * - * @param mixed $transport A transport definition - * @param \Elastica\Connection $connection A connection instance - * @param array $params Parameters for the transport class * @throws \Elastica\Exception\InvalidException + * + * @param mixed $transport A transport definition + * @param \Elastica\Connection $connection A connection instance + * @param array $params Parameters for the transport class * @return AbstractTransport */ public static function create($transport, Connection $connection, array $params = array()) diff --git a/lib/Elastica/Transport/Guzzle.php b/lib/Elastica/Transport/Guzzle.php index 0db6b3bd9e..803129fabb 100644 --- a/lib/Elastica/Transport/Guzzle.php +++ b/lib/Elastica/Transport/Guzzle.php @@ -41,12 +41,13 @@ class Guzzle extends AbstractTransport * * All calls that are made to the server are done through this function * - * @param \Elastica\Request $request - * @param array $params Host, Port, ... * @throws \Elastica\Exception\ConnectionException * @throws \Elastica\Exception\ResponseException * @throws \Elastica\Exception\Connection\HttpException - * @return \Elastica\Response Response object + * + * @param \Elastica\Request $request + * @param array $params Host, Port, ... + * @return \Elastica\Response Response object */ public function exec(Request $request, array $params) { diff --git a/lib/Elastica/Transport/Http.php b/lib/Elastica/Transport/Http.php index 4a86d9b3c1..eb55012df5 100644 --- a/lib/Elastica/Transport/Http.php +++ b/lib/Elastica/Transport/Http.php @@ -37,12 +37,13 @@ class Http extends AbstractTransport * * All calls that are made to the server are done through this function * - * @param \Elastica\Request $request - * @param array $params Host, Port, ... * @throws \Elastica\Exception\ConnectionException * @throws \Elastica\Exception\ResponseException * @throws \Elastica\Exception\Connection\HttpException - * @return \Elastica\Response Response object + * + * @param \Elastica\Request $request + * @param array $params Host, Port, ... + * @return \Elastica\Response Response object */ public function exec(Request $request, array $params) { diff --git a/lib/Elastica/Transport/HttpAdapter.php b/lib/Elastica/Transport/HttpAdapter.php index 76e0898963..ae362947b5 100644 --- a/lib/Elastica/Transport/HttpAdapter.php +++ b/lib/Elastica/Transport/HttpAdapter.php @@ -40,12 +40,13 @@ public function __construct(Connection $connection = null, HttpAdapterInterface * * All calls that are made to the server are done through this function * - * @param \Elastica\Request $elasticaRequest - * @param array $params Host, Port, ... * @throws \Elastica\Exception\ConnectionException * @throws \Elastica\Exception\ResponseException * @throws \Elastica\Exception\Connection\HttpException - * @return \Elastica\Response Response object + * + * @param \Elastica\Request $elasticaRequest + * @param array $params Host, Port, ... + * @return \Elastica\Response Response object */ public function exec(ElasticaRequest $elasticaRequest, array $params) { diff --git a/lib/Elastica/Transport/Memcache.php b/lib/Elastica/Transport/Memcache.php index e56f216a4b..9ae2ebb3aa 100644 --- a/lib/Elastica/Transport/Memcache.php +++ b/lib/Elastica/Transport/Memcache.php @@ -24,11 +24,12 @@ class Memcache extends AbstractTransport /** * Makes calls to the elasticsearch server * - * @param \Elastica\Request $request - * @param array $params Host, Port, ... * @throws \Elastica\Exception\ResponseException * @throws \Elastica\Exception\InvalidException - * @return \Elastica\Response Response object + * + * @param \Elastica\Request $request + * @param array $params Host, Port, ... + * @return \Elastica\Response Response object */ public function exec(Request $request, array $params) { @@ -99,7 +100,8 @@ public function exec(Request $request, array $params) * Check if key that will be used dont exceed 250 symbols * * @throws Elastica\Exception\Connection\MemcacheException If key is too long - * @param string $key + * + * @param string $key */ private function _checkKeyLength($key) { diff --git a/lib/Elastica/Transport/Thrift.php b/lib/Elastica/Transport/Thrift.php index 5ca6cff230..e584ceee04 100644 --- a/lib/Elastica/Transport/Thrift.php +++ b/lib/Elastica/Transport/Thrift.php @@ -37,8 +37,9 @@ class Thrift extends AbstractTransport /** * Construct transport * - * @param \Elastica\Connection $connection Connection object * @throws \Elastica\Exception\RuntimeException + * + * @param \Elastica\Connection $connection Connection object */ public function __construct(Connection $connection = null) { @@ -103,11 +104,12 @@ protected function _getClient($host, $port, $sendTimeout = null, $recvTimeout = /** * Makes calls to the elasticsearch server * - * @param \Elastica\Request $request - * @param array $params Host, Port, ... * @throws \Elastica\Exception\Connection\ThriftException * @throws \Elastica\Exception\ResponseException - * @return \Elastica\Response Response object + * + * @param \Elastica\Request $request + * @param array $params Host, Port, ... + * @return \Elastica\Response Response object */ public function exec(Request $request, array $params) { diff --git a/lib/Elastica/Type.php b/lib/Elastica/Type.php index 2b44e4df48..d0a643b859 100644 --- a/lib/Elastica/Type.php +++ b/lib/Elastica/Type.php @@ -108,10 +108,11 @@ public function addDocument(Document $doc) } /** + * @throws Exception\RuntimeException + * * @param $object - * @param Document $doc + * @param Document $doc * @return Response - * @throws Exception\RuntimeException */ public function addObject($object, Document $doc = null) { @@ -131,11 +132,12 @@ public function addObject($object, Document $doc = null) /** * Update document, using update script. Requires elasticsearch >= 0.19.0 * - * @param \Elastica\Document|\Elastica\Script $data Document with update data - * @param array $options array of query params to use for query. For possible options check es api + * @link http://www.elasticsearch.org/guide/reference/api/update.html * @throws \Elastica\Exception\InvalidException + * + * @param \Elastica\Document|\Elastica\Script $data Document with update data + * @param array $options array of query params to use for query. For possible options check es api * @return \Elastica\Response - * @link http://www.elasticsearch.org/guide/reference/api/update.html */ public function updateDocument($data, array $options = array()) { @@ -218,10 +220,11 @@ public function addObjects(array $objects) /** * Get the document from search index * - * @param string $id Document id - * @param array $options Options for the get request. * @throws \Elastica\Exception\NotFoundException * @throws \Elastica\Exception\ResponseException + * + * @param string $id Document id + * @param array $options Options for the get request. * @return \Elastica\Document */ public function getDocument($id, $options = array()) @@ -403,12 +406,13 @@ public function deleteDocuments(array $docs) /** * Deletes an entry by its unique identifier * - * @param int|string $id Document id - * @param array $options * @throws \InvalidArgumentException * @throws \Elastica\Exception\NotFoundException - * @return \Elastica\Response Response object * @link http://www.elasticsearch.org/guide/reference/api/delete.html + * + * @param int|string $id Document id + * @param array $options + * @return \Elastica\Response Response object */ public function deleteById($id, array $options = array()) { @@ -516,11 +520,14 @@ public function request($path, $method, $data = array(), array $query = array()) * Sets the serializer callable used in addObject * @see \Elastica\Type::addObject * - * @param array|string $serializer @see \Elastica\Type::_serializer + * @param array|string $serializer @see \Elastica\Type::_serializer + * @return $this */ public function setSerializer($serializer) { $this->_serializer = $serializer; + + return $this; } /** diff --git a/lib/Elastica/Type/AbstractType.php b/lib/Elastica/Type/AbstractType.php index 241207f597..624e4cbb87 100644 --- a/lib/Elastica/Type/AbstractType.php +++ b/lib/Elastica/Type/AbstractType.php @@ -94,8 +94,9 @@ abstract class AbstractType implements SearchableInterface * Reads index and type name from protected vars _indexName and _typeName. * Has to be set in child class * - * @param \Elastica\Client $client OPTIONAL Client object * @throws \Elastica\Exception\InvalidException + * + * @param \Elastica\Client $client OPTIONAL Client object */ public function __construct(Client $client = null) { diff --git a/lib/Elastica/Type/Mapping.php b/lib/Elastica/Type/Mapping.php index b8079ace4c..945b36705c 100644 --- a/lib/Elastica/Type/Mapping.php +++ b/lib/Elastica/Type/Mapping.php @@ -50,8 +50,8 @@ public function __construct(Type $type = null, array $properties = array()) /** * Sets the mapping type * Enter description here ... - * @param \Elastica\Type $type Type object - * @return \Elastica\Type\Mapping Current object + * @param \Elastica\Type $type Type object + * @return $this */ public function setType(Type $type) { @@ -63,8 +63,8 @@ public function setType(Type $type) /** * Sets the mapping properties * - * @param array $properties Properties - * @return \Elastica\Type\Mapping Mapping object + * @param array $properties Properties + * @return $this */ public function setProperties(array $properties) { @@ -83,8 +83,8 @@ public function getProperties() /** * Sets the mapping _meta - * @param array $meta metadata - * @return \Elastica\Type\Mapping Mapping object + * @param array $meta metadata + * @return $this * @link http://www.elasticsearch.org/guide/reference/mapping/meta.html */ public function setMeta(array $meta) @@ -108,8 +108,8 @@ public function getType() * To disable source, argument is * array('enabled' => false) * - * @param array $source Source array - * @return \Elastica\Type\Mapping Current object + * @param array $source Source array + * @return $this * @link http://www.elasticsearch.org/guide/reference/mapping/source-field.html */ public function setSource(array $source) @@ -122,8 +122,8 @@ public function setSource(array $source) * * Param can be set to true to enable again * - * @param bool $enabled OPTIONAL (default = false) - * @return \Elastica\Type\Mapping Current object + * @param bool $enabled OPTIONAL (default = false) + * @return $this */ public function disableSource($enabled = false) { @@ -147,9 +147,9 @@ public function disableSource($enabled = false) * _size * properties * - * @param string $key Key name - * @param mixed $value Key value - * @return \Elastica\Type\Mapping Current object + * @param string $key Key name + * @param mixed $value Key value + * @return $this */ public function setParam($key, $value) { @@ -173,8 +173,8 @@ public function getParam($key) /** * Sets params for the "_all" field * - * @param array $params _all Params (enabled, store, term_vector, analyzer) - * @return \Elastica\Type\Mapping + * @param array $params _all Params (enabled, store, term_vector, analyzer) + * @return $this */ public function setAllField(array $params) { @@ -184,8 +184,8 @@ public function setAllField(array $params) /** * Enables the "_all" field * - * @param bool $enabled OPTIONAL (default = true) - * @return \Elastica\Type\Mapping + * @param bool $enabled OPTIONAL (default = true) + * @return $this */ public function enableAllField($enabled = true) { @@ -195,8 +195,8 @@ public function enableAllField($enabled = true) /** * Set TTL * - * @param array $params TTL Params (enabled, default, ...) - * @return \Elastica\Type\Mapping + * @param array $params TTL Params (enabled, default, ...) + * @return $this */ public function setTtl(array $params) { @@ -206,8 +206,8 @@ public function setTtl(array $params) /** * Enables TTL for all documents in this type * - * @param bool $enabled OPTIONAL (default = true) - * @return \Elastica\Type\Mapping + * @param bool $enabled OPTIONAL (default = true) + * @return $this */ public function enableTtl($enabled = true) { @@ -217,8 +217,8 @@ public function enableTtl($enabled = true) /** * Set parent type * - * @param string $type Parent type - * @return \Elastica\Type\Mapping + * @param string $type Parent type + * @return $this */ public function setParent($type) { @@ -229,7 +229,8 @@ public function setParent($type) * Converts the mapping to an array * * @throws \Elastica\Exception\InvalidException - * @return array Mapping as array + * + * @return array Mapping as array */ public function toArray() { @@ -257,9 +258,10 @@ public function send() /** * Creates a mapping object * - * @param array|\Elastica\Type\Mapping $mapping Mapping object or properties array - * @return \Elastica\Type\Mapping Mapping object * @throws \Elastica\Exception\InvalidException If invalid type + * + * @param array|\Elastica\Type\Mapping $mapping Mapping object or properties array + * @return self */ public static function create($mapping) { diff --git a/lib/Elastica/Util.php b/lib/Elastica/Util.php index 94896a74fa..a272892281 100644 --- a/lib/Elastica/Util.php +++ b/lib/Elastica/Util.php @@ -18,10 +18,11 @@ class Util * and * escapes the following terms: + - && || ! ( ) { } [ ] ^ " ~ * ? : \ * - * @param string $term Query term to replace and escape - * @return string Replaced and escaped query term * @link http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Boolean%20operators * @link http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Escaping%20Special%20Characters + * + * @param string $term Query term to replace and escape + * @return string Replaced and escaped query term */ public static function replaceBooleanWordsAndEscapeTerm($term) { @@ -36,9 +37,10 @@ public static function replaceBooleanWordsAndEscapeTerm($term) * Escapes the following terms (because part of the query language) * + - && || ! ( ) { } [ ] ^ " ~ * ? : \ * + * @link http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Escaping%20Special%20Characters + * * @param string $term Query term to escape * @return string Escaped query term - * @link http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Escaping%20Special%20Characters */ public static function escapeTerm($term) { @@ -57,9 +59,10 @@ public static function escapeTerm($term) * Replace the following reserved words (because part of the query language) * AND OR NOT * + * @link http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Boolean%20operators + * * @param string $term Query term to replace * @return string Replaced query term - * @link http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Boolean%20operators */ public static function replaceBooleanWords($term) { diff --git a/test/lib/Elastica/Test/Aggregation/FiltersTest.php b/test/lib/Elastica/Test/Aggregation/FiltersTest.php index 7df911489b..83f320ec00 100644 --- a/test/lib/Elastica/Test/Aggregation/FiltersTest.php +++ b/test/lib/Elastica/Test/Aggregation/FiltersTest.php @@ -6,7 +6,6 @@ use Elastica\Aggregation\Filter; use Elastica\Aggregation\Filters; use Elastica\Document; -use Elastica\Filter\Range; use Elastica\Filter\Term; use Elastica\Query; @@ -32,12 +31,12 @@ public function testToArrayUsingNamedFilters() "filters" => array( "filters" => array( "blue" => array( - "term" => array("color" => "blue") + "term" => array("color" => "blue"), ), "red" => array( - "term" => array("color" => "red") - ) - ) + "term" => array("color" => "red"), + ), + ), ), "aggs" => array( "avg_price" => array("avg" => array("field" => "price")), @@ -61,12 +60,12 @@ public function testToArrayUsingAnonymousFilters() "filters" => array( "filters" => array( array( - "term" => array("color" => "blue") + "term" => array("color" => "blue"), ), array( - "term" => array("color" => "red") - ) - ) + "term" => array("color" => "red"), + ), + ), ), "aggs" => array( "avg_price" => array("avg" => array("field" => "price")), diff --git a/test/lib/Elastica/Test/BulkTest.php b/test/lib/Elastica/Test/BulkTest.php index 4f0034221b..a5e05837ac 100644 --- a/test/lib/Elastica/Test/BulkTest.php +++ b/test/lib/Elastica/Test/BulkTest.php @@ -646,6 +646,18 @@ public function testRetry() $this->assertEquals(5, $metadata[ '_retry_on_conflict' ]); } + public function testSetShardTimeout() + { + $bulk = new Bulk($this->_getClient()); + $this->assertInstanceOf('Elastica\Bulk', $bulk->setShardTimeout(10)); + } + + public function testSetRequestParam() + { + $bulk = new Bulk($this->_getClient()); + $this->assertInstanceOf('Elastica\Bulk', $bulk->setRequestParam('key', 'value')); + } + public function udpDataProvider() { return array( diff --git a/test/lib/Elastica/Test/ClientTest.php b/test/lib/Elastica/Test/ClientTest.php index 87e2f3cbbd..044ae9e0fd 100644 --- a/test/lib/Elastica/Test/ClientTest.php +++ b/test/lib/Elastica/Test/ClientTest.php @@ -6,6 +6,7 @@ use Elastica\Connection; use Elastica\Document; use Elastica\Exception\Connection\HttpException; +use Elastica\Exception\InvalidException; use Elastica\Index; use Elastica\Request; use Elastica\Script; @@ -1002,4 +1003,59 @@ public function testJSONQuery() $this->assertEquals(1, $responseArray['hits']['total']); } + + public function testAddHeader() + { + $client = new Client(); + + // add one header + $client->addHeader('foo', 'bar'); + $this->assertEquals(array('foo' => 'bar'), $client->getConfigValue('headers')); + + // check class + $this->assertInstanceOf('Elastica\Client', $client->addHeader('foo', 'bar')); + + // check invalid parameters + try { + $client->addHeader(new \stdClass(), 'foo'); + $this->fail('Header name is not a string but exception not thrown'); + } catch (InvalidException $ex) { + } + + try { + $client->addHeader('foo', new \stdClass()); + $this->fail('Header value is not a string but exception not thrown'); + } catch (InvalidException $ex) { + } + } + + public function testRemoveHeader() + { + $client = new Client(); + + // set headers + $headers = array( + 'first' => 'first value', + 'second' => 'second value', + ); + foreach ($headers as $key => $value) { + $client->addHeader($key, $value); + } + $this->assertEquals($headers, $client->getConfigValue('headers')); + + // remove one + $client->removeHeader('first'); + unset($headers['first']); + $this->assertEquals($headers, $client->getConfigValue('headers')); + + // check class + $this->assertInstanceOf('Elastica\Client', $client->removeHeader('second')); + + // check invalid parameter + try { + $client->removeHeader(new \stdClass()); + $this->fail('Header name is not a string but exception not thrown'); + } catch (InvalidException $ex) { + } + } } diff --git a/test/lib/Elastica/Test/Connection/ConnectionPollTest.php b/test/lib/Elastica/Test/Connection/ConnectionPollTest.php index 12e97cc9ab..550fb19486 100644 --- a/test/lib/Elastica/Test/Connection/ConnectionPollTest.php +++ b/test/lib/Elastica/Test/Connection/ConnectionPollTest.php @@ -30,6 +30,24 @@ public function testSetConnections() $pool->setConnections($connections); $this->assertEquals($connections, $pool->getConnections()); + + $this->assertInstanceOf('Elastica\Connection\ConnectionPool', $pool->setConnections($connections)); + } + + public function testAddConnection() + { + $pool = $this->createPool(); + $pool->setConnections(array()); + + $connections = $this->getConnections(5); + + foreach ($connections as $connection) { + $pool->addConnection($connection); + } + + $this->assertEquals($connections, $pool->getConnections()); + + $this->assertInstanceOf('Elastica\Connection\ConnectionPool', $pool->addConnection($connections[0])); } public function testHasConnection() diff --git a/test/lib/Elastica/Test/Filter/GeoShapePreIndexedTest.php b/test/lib/Elastica/Test/Filter/GeoShapePreIndexedTest.php index a6b6baa540..9360800c61 100644 --- a/test/lib/Elastica/Test/Filter/GeoShapePreIndexedTest.php +++ b/test/lib/Elastica/Test/Filter/GeoShapePreIndexedTest.php @@ -87,4 +87,12 @@ public function testGeoProvided() $index->delete(); } + + public function testSetRelation() + { + $gsp = new GeoShapePreIndexed('location', '1', 'type', 'indexName', 'location'); + $gsp->setRelation(AbstractGeoShape::RELATION_INTERSECT); + $this->assertEquals(AbstractGeoShape::RELATION_INTERSECT, $gsp->getRelation()); + $this->assertInstanceOf('Elastica\Filter\GeoShapePreIndexed', $gsp->setRelation(AbstractGeoShape::RELATION_INTERSECT)); + } } diff --git a/test/lib/Elastica/Test/Filter/GeoShapeProvidedTest.php b/test/lib/Elastica/Test/Filter/GeoShapeProvidedTest.php index 41f4858b0d..01ff8b4087 100644 --- a/test/lib/Elastica/Test/Filter/GeoShapeProvidedTest.php +++ b/test/lib/Elastica/Test/Filter/GeoShapeProvidedTest.php @@ -83,4 +83,12 @@ public function testConstructPolygon() $this->assertEquals($expected, $gsp->toArray()); } + + public function testSetRelation() + { + $gsp = new GeoShapeProvided('location', array(array(25.0, 75.0), array(75.0, 25.0))); + $gsp->setRelation(AbstractGeoShape::RELATION_INTERSECT); + $this->assertEquals(AbstractGeoShape::RELATION_INTERSECT, $gsp->getRelation()); + $this->assertInstanceOf('Elastica\Filter\GeoShapeProvided', $gsp->setRelation(AbstractGeoShape::RELATION_INTERSECT)); + } } diff --git a/test/lib/Elastica/Test/Filter/RangeTest.php b/test/lib/Elastica/Test/Filter/RangeTest.php index 6a642102d6..ecf587ba68 100644 --- a/test/lib/Elastica/Test/Filter/RangeTest.php +++ b/test/lib/Elastica/Test/Filter/RangeTest.php @@ -41,7 +41,8 @@ public function testSetExecution() /** * Tests that parent fields are not overwritten by the toArray method */ - public function testSetCachedNotOverwritten() { + public function testSetCachedNotOverwritten() + { $filter = new Range('field_name', array()); $filter->setCached(true); $array = $filter->toArray(); diff --git a/test/lib/Elastica/Test/Filter/RegexpTest.php b/test/lib/Elastica/Test/Filter/RegexpTest.php index 65f700d2b4..28539a19a0 100644 --- a/test/lib/Elastica/Test/Filter/RegexpTest.php +++ b/test/lib/Elastica/Test/Filter/RegexpTest.php @@ -24,26 +24,26 @@ public function testToArray() $this->assertequals($expectedArray, $filter->toArray()); } - + public function testToArrayWithOptions() { $field = 'name'; $regexp = 'ruf'; $options = array( - 'flags' => 'ALL' + 'flags' => 'ALL', ); - + $filter = new Regexp($field, $regexp, $options); - + $expectedArray = array( 'regexp' => array( $field => array( 'value' => $regexp, - 'flags' => 'ALL' - ) - ) + 'flags' => 'ALL', + ), + ), ); - + $this->assertequals($expectedArray, $filter->toArray()); } diff --git a/test/lib/Elastica/Test/Query/MatchTest.php b/test/lib/Elastica/Test/Query/MatchTest.php index 23c9fed767..d2febbdf99 100644 --- a/test/lib/Elastica/Test/Query/MatchTest.php +++ b/test/lib/Elastica/Test/Query/MatchTest.php @@ -223,7 +223,6 @@ public function testMatchPhrasePrefixAlias() $this->assertEquals(2, $resultSet->count()); } - public function testMatchFuzzinessType() { $field = 'test'; diff --git a/test/lib/Elastica/Test/QueryTest.php b/test/lib/Elastica/Test/QueryTest.php index fc0906527b..5d98c28298 100644 --- a/test/lib/Elastica/Test/QueryTest.php +++ b/test/lib/Elastica/Test/QueryTest.php @@ -81,6 +81,13 @@ public function testSuggestShouldNotRemoveOtherParameters() $this->assertEquals($query1->toArray(), $query2->toArray()); } + public function testSetSuggestMustReturnQueryInstance() + { + $query = new Query(); + $suggest = new Suggest(); + $this->assertInstanceOf('Elastica\Query', $query->setSuggest($suggest)); + } + public function testArrayQuery() { $query = array( diff --git a/test/lib/Elastica/Test/ScriptTest.php b/test/lib/Elastica/Test/ScriptTest.php index 6661b32966..56dc472989 100644 --- a/test/lib/Elastica/Test/ScriptTest.php +++ b/test/lib/Elastica/Test/ScriptTest.php @@ -126,4 +126,26 @@ public function dataProviderCreateInvalid() ), ); } + + public function testSetLang() + { + $script = new Script('foo', array(), Script::LANG_GROOVY); + $this->assertEquals(Script::LANG_GROOVY, $script->getLang()); + + $script->setLang(Script::LANG_PYTHON); + $this->assertEquals(Script::LANG_PYTHON, $script->getLang()); + + $this->assertInstanceOf('Elastica\Script', $script->setLang(Script::LANG_PYTHON)); + } + + public function testSetScript() + { + $script = new Script('foo'); + $this->assertEquals('foo', $script->getScript()); + + $script->setScript('bar'); + $this->assertEquals('bar', $script->getScript()); + + $this->assertInstanceOf('Elastica\Script', $script->setScript('foo')); + } } diff --git a/test/lib/Elastica/Test/Type/MappingTest.php b/test/lib/Elastica/Test/Type/MappingTest.php index 2dd6c5ac07..1d722784ab 100644 --- a/test/lib/Elastica/Test/Type/MappingTest.php +++ b/test/lib/Elastica/Test/Type/MappingTest.php @@ -123,7 +123,7 @@ public function testNestedMapping() ); $response = $type->setMapping($mapping); - $this->assertFalse($response->hasError()); + $this->assertFalse($response->hasError()); $doc = new Document(1, array( 'user' => array( @@ -137,7 +137,7 @@ public function testNestedMapping() $index->refresh(); $resultSet = $type->search('ruflin'); - $this->assertEquals($resultSet->count(), 1); + $this->assertEquals($resultSet->count(), 1); $index->delete(); } diff --git a/test/lib/Elastica/Test/TypeTest.php b/test/lib/Elastica/Test/TypeTest.php index e09242934a..e68b87a478 100644 --- a/test/lib/Elastica/Test/TypeTest.php +++ b/test/lib/Elastica/Test/TypeTest.php @@ -799,7 +799,7 @@ public function testAddObject() $index = $this->_createIndex(); $type = new Type($index, 'user'); - $type->setSerializer(array(new SerializerMock(), 'serialize')); + $type->setSerializer('get_object_vars'); $userObject = new \stdClass(); $userObject->username = 'hans'; @@ -818,6 +818,14 @@ public function testAddObject() $this->assertEquals('hans', $data['username']); } + public function testSetSerializer() + { + $index = $this->_createIndex(); + $type = $index->getType('user'); + $ret = $type->setSerializer('get_object_vars'); + $this->assertInstanceOf('Elastica\Type', $ret); + } + public function testExists() { $index = $this->_createIndex(); @@ -880,11 +888,3 @@ public function testGetMappingAlias() ); } } - -class SerializerMock -{ - public function serialize($object) - { - return get_object_vars($object); - } -} diff --git a/test/shutdown/ShutdownTest.php b/test/shutdown/ShutdownTest.php index 641a863575..4798300ddd 100644 --- a/test/shutdown/ShutdownTest.php +++ b/test/shutdown/ShutdownTest.php @@ -28,7 +28,7 @@ public function testNodeShutdown() // sayonara, wolverine, we'd never love you foreach ($nodes as $node) { - if ((int)$node->getInfo()->getPort() === 9201) { + if ((int) $node->getInfo()->getPort() === 9201) { $node->shutdown('1s'); break; }