summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-20 09:00:55 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-20 09:00:55 +0100
commita2190ac74dd4d7080b12bab90e552d7aa81209ef (patch)
tree8b31f38de9882d18df54cf8d9e0de74167a094eb /vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php
parent15e69f7b20b6596b9148030acce5b59993b95a45 (diff)
parent257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff)
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php141
1 files changed, 78 insertions, 63 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php b/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php
index 7d0b0094..89ea77cd 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Query/QueryString.php
@@ -1,27 +1,26 @@
<?php
-
namespace Elastica\Query;
+
use Elastica\Exception\InvalidException;
/**
- * QueryString query
+ * QueryString query.
*
- * @category Xodoa
- * @package Elastica
* @author Nicolas Ruflin <spam@ruflin.com>, Jasper van Wanrooy <jasper@vanwanrooy.net>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
*/
class QueryString extends AbstractQuery
{
/**
- * Query string
+ * Query string.
*
* @var string Query string
*/
protected $_queryString = '';
/**
- * Creates query string object. Calls setQuery with argument
+ * Creates query string object. Calls setQuery with argument.
*
* @param string $queryString OPTIONAL Query string for object
*/
@@ -31,11 +30,13 @@ class QueryString extends AbstractQuery
}
/**
- * Sets a new query string for the object
+ * Sets a new query string for the object.
+ *
+ * @param string $query Query string
+ *
+ * @throws \Elastica\Exception\InvalidException If given parameter is not a string
*
- * @param string $query Query string
- * @throws \Elastica\Exception\InvalidException
- * @return \Elastica\Query\QueryString Current object
+ * @return $this
*/
public function setQuery($query = '')
{
@@ -47,12 +48,13 @@ class QueryString extends AbstractQuery
}
/**
- * Sets the default field
+ * Sets the default field.
*
* If no field is set, _all is chosen
*
- * @param string $field Field
- * @return \Elastica\Query\QueryString Current object
+ * @param string $field Field
+ *
+ * @return $this
*/
public function setDefaultField($field)
{
@@ -60,12 +62,13 @@ class QueryString extends AbstractQuery
}
/**
- * Sets the default operator AND or OR
+ * Sets the default operator AND or OR.
*
* If no operator is set, OR is chosen
*
- * @param string $operator Operator
- * @return \Elastica\Query\QueryString Current object
+ * @param string $operator Operator
+ *
+ * @return $this
*/
public function setDefaultOperator($operator)
{
@@ -75,8 +78,9 @@ class QueryString extends AbstractQuery
/**
* Sets the analyzer to analyze the query with.
*
- * @param string $analyzer Analyser to use
- * @return \Elastica\Query\QueryString Current object
+ * @param string $analyzer Analyser to use
+ *
+ * @return $this
*/
public function setAnalyzer($analyzer)
{
@@ -88,8 +92,9 @@ class QueryString extends AbstractQuery
*
* If not set, defaults to true.
*
- * @param bool $allow
- * @return \Elastica\Query\QueryString Current object
+ * @param bool $allow
+ *
+ * @return $this
*/
public function setAllowLeadingWildcard($allow = true)
{
@@ -97,25 +102,13 @@ class QueryString extends AbstractQuery
}
/**
- * Sets the parameter to auto-lowercase terms of some queries.
- *
- * If not set, defaults to true.
- *
- * @param bool $lowercase
- * @return \Elastica\Query\QueryString Current object
- */
- public function setLowercaseExpandedTerms($lowercase = true)
- {
- return $this->setParam('lowercase_expanded_terms', (bool) $lowercase);
- }
-
- /**
* Sets the parameter to enable the position increments in result queries.
*
* If not set, defaults to true.
*
- * @param bool $enabled
- * @return \Elastica\Query\QueryString Current object
+ * @param bool $enabled
+ *
+ * @return $this
*/
public function setEnablePositionIncrements($enabled = true)
{
@@ -127,8 +120,9 @@ class QueryString extends AbstractQuery
*
* If not set, defaults to 0.
*
- * @param int $length
- * @return \Elastica\Query\QueryString Current object
+ * @param int $length
+ *
+ * @return $this
*/
public function setFuzzyPrefixLength($length = 0)
{
@@ -140,8 +134,9 @@ class QueryString extends AbstractQuery
*
* If not set, defaults to 0.5
*
- * @param float $minSim
- * @return \Elastica\Query\QueryString Current object
+ * @param float $minSim
+ *
+ * @return $this
*/
public function setFuzzyMinSim($minSim = 0.5)
{
@@ -154,8 +149,9 @@ class QueryString extends AbstractQuery
* If zero, exact phrases are required.
* If not set, defaults to zero.
*
- * @param int $phraseSlop
- * @return \Elastica\Query\QueryString Current object
+ * @param int $phraseSlop
+ *
+ * @return $this
*/
public function setPhraseSlop($phraseSlop = 0)
{
@@ -167,8 +163,9 @@ class QueryString extends AbstractQuery
*
* If not set, defaults to 1.0.
*
- * @param float $boost
- * @return \Elastica\Query\QueryString Current object
+ * @param float $boost
+ *
+ * @return $this
*/
public function setBoost($boost = 1.0)
{
@@ -180,8 +177,9 @@ class QueryString extends AbstractQuery
*
* If not set, defaults to true
*
- * @param bool $analyze
- * @return \Elastica\Query\QueryString Current object
+ * @param bool $analyze
+ *
+ * @return $this
*/
public function setAnalyzeWildcard($analyze = true)
{
@@ -193,8 +191,9 @@ class QueryString extends AbstractQuery
*
* If not set, defaults to true.
*
- * @param bool $autoGenerate
- * @return \Elastica\Query\QueryString Current object
+ * @param bool $autoGenerate
+ *
+ * @return $this
*/
public function setAutoGeneratePhraseQueries($autoGenerate = true)
{
@@ -202,13 +201,13 @@ class QueryString extends AbstractQuery
}
/**
- * Sets the fields
+ * Sets the fields. If no fields are set, _all is chosen.
+ *
+ * @param array $fields Fields
*
- * If no fields are set, _all is chosen
+ * @throws \Elastica\Exception\InvalidException If given parameter is not an array
*
- * @param array $fields Fields
- * @throws \Elastica\Exception\InvalidException
- * @return \Elastica\Query\QueryString Current object
+ * @return $this
*/
public function setFields(array $fields)
{
@@ -222,8 +221,9 @@ class QueryString extends AbstractQuery
/**
* Whether to use bool or dis_max queries to internally combine results for multi field search.
*
- * @param bool $value Determines whether to use
- * @return \Elastica\Query\QueryString Current object
+ * @param bool $value Determines whether to use
+ *
+ * @return $this
*/
public function setUseDisMax($value = true)
{
@@ -235,8 +235,9 @@ class QueryString extends AbstractQuery
*
* If not set, defaults to 0.
*
- * @param int $tieBreaker
- * @return \Elastica\Query\QueryString Current object
+ * @param int $tieBreaker
+ *
+ * @return $this
*/
public function setTieBreaker($tieBreaker = 0)
{
@@ -244,24 +245,38 @@ class QueryString extends AbstractQuery
}
/**
- * Set a re-write condition. See https://github.com/elasticsearch/elasticsearch/issues/1186 for additional information
+ * Set a re-write condition. See https://github.com/elasticsearch/elasticsearch/issues/1186 for additional information.
*
- * @param string $rewrite
- * @return \Elastica\Query\QueryString Current object
+ * @param string $rewrite
+ *
+ * @return $this
*/
- public function setRewrite($rewrite = "")
+ public function setRewrite($rewrite = '')
{
return $this->setParam('rewrite', $rewrite);
}
/**
- * Converts query to array
+ * Set timezone option.
+ *
+ * @param string $timezone
+ *
+ * @return $this
+ */
+ public function setTimezone($timezone)
+ {
+ return $this->setParam('time_zone', $timezone);
+ }
+
+ /**
+ * Converts query to array.
*
* @see \Elastica\Query\AbstractQuery::toArray()
+ *
* @return array Query array
*/
public function toArray()
{
- return array('query_string' => array_merge(array('query' => $this->_queryString), $this->getParams()),);
+ return array('query_string' => array_merge(array('query' => $this->_queryString), $this->getParams()));
}
}