summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Query/Match.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Query/Match.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Query/Match.php154
1 files changed, 89 insertions, 65 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/Match.php b/vendor/ruflin/elastica/lib/Elastica/Query/Match.php
index ba66ad63..abb40970 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Query/Match.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Query/Match.php
@@ -1,27 +1,37 @@
<?php
-
namespace Elastica\Query;
/**
- * Match query
+ * Match query.
*
- * @category Xodoa
- * @package Elastica
* @author F21
* @author WONG Wing Lun <luiges90@gmail.com>
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/match-query.html
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html
*/
class Match extends AbstractQuery
{
- const ZERO_TERM_NONE = 'none';
- const ZERO_TERM_ALL = 'all';
+ const ZERO_TERM_NONE = 'none';
+ const ZERO_TERM_ALL = 'all';
+
+ /**
+ * @param string $field
+ * @param mixed $values
+ */
+ public function __construct($field = null, $values = null)
+ {
+ if ($field !== null && $values !== null) {
+ $this->setParam($field, $values);
+ }
+ }
/**
- * Sets a param for the message array
+ * Sets a param for the message array.
+ *
+ * @param string $field
+ * @param mixed $values
*
- * @param string $field
- * @param mixed $values
- * @return \Elastica\Query\Match
+ * @return $this
*/
public function setField($field, $values)
{
@@ -29,12 +39,13 @@ class Match extends AbstractQuery
}
/**
- * Sets a param for the given field
+ * Sets a param for the given field.
*
- * @param string $field
- * @param string $key
- * @param string $value
- * @return \Elastica\Query\Match
+ * @param string $field
+ * @param string $key
+ * @param string $value
+ *
+ * @return $this
*/
public function setFieldParam($field, $key, $value)
{
@@ -48,11 +59,12 @@ class Match extends AbstractQuery
}
/**
- * Sets the query string
+ * Sets the query string.
+ *
+ * @param string $field
+ * @param string $query
*
- * @param string $field
- * @param string $query
- * @return \Elastica\Query\Match
+ * @return $this
*/
public function setFieldQuery($field, $query)
{
@@ -60,11 +72,12 @@ class Match extends AbstractQuery
}
/**
- * Set field type
+ * Set field type.
+ *
+ * @param string $field
+ * @param string $type
*
- * @param string $field
- * @param string $type
- * @return \Elastica\Query\Match
+ * @return $this
*/
public function setFieldType($field, $type)
{
@@ -72,11 +85,12 @@ class Match extends AbstractQuery
}
/**
- * Set field operator
+ * Set field operator.
*
- * @param string $field
- * @param string $operator
- * @return \Elastica\Query\Match
+ * @param string $field
+ * @param string $operator
+ *
+ * @return $this
*/
public function setFieldOperator($field, $operator)
{
@@ -84,11 +98,12 @@ class Match extends AbstractQuery
}
/**
- * Set field analyzer
+ * Set field analyzer.
+ *
+ * @param string $field
+ * @param string $analyzer
*
- * @param string $field
- * @param string $analyzer
- * @return \Elastica\Query\Match
+ * @return $this
*/
public function setFieldAnalyzer($field, $analyzer)
{
@@ -96,13 +111,14 @@ class Match extends AbstractQuery
}
/**
- * Set field boost value
+ * Set field boost value.
*
* If not set, defaults to 1.0.
*
- * @param string $field
- * @param float $boost
- * @return \Elastica\Query\Match
+ * @param string $field
+ * @param float $boost
+ *
+ * @return $this
*/
public function setFieldBoost($field, $boost = 1.0)
{
@@ -110,12 +126,14 @@ class Match extends AbstractQuery
}
/**
- * Set field minimum should match
+ * Set field minimum should match.
*
- * @param string $field
- * @param int|string $minimumShouldMatch
- * @return \Elastica\Query\Match
- * @link Possible values for minimum_should_match http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html
+ * @param string $field
+ * @param int|string $minimumShouldMatch
+ *
+ * @return $this
+ *
+ * @link Possible values for minimum_should_match http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html
*/
public function setFieldMinimumShouldMatch($field, $minimumShouldMatch)
{
@@ -123,11 +141,12 @@ class Match extends AbstractQuery
}
/**
- * Set field fuzziness
+ * Set field fuzziness.
+ *
+ * @param string $field
+ * @param mixed $fuzziness
*
- * @param string $field
- * @param mixed $fuzziness
- * @return \Elastica\Query\Match
+ * @return $this
*/
public function setFieldFuzziness($field, $fuzziness)
{
@@ -135,11 +154,12 @@ class Match extends AbstractQuery
}
/**
- * Set field fuzzy rewrite
+ * Set field fuzzy rewrite.
*
- * @param string $field
- * @param string $fuzzyRewrite
- * @return \Elastica\Query\Match
+ * @param string $field
+ * @param string $fuzzyRewrite
+ *
+ * @return $this
*/
public function setFieldFuzzyRewrite($field, $fuzzyRewrite)
{
@@ -147,11 +167,12 @@ class Match extends AbstractQuery
}
/**
- * Set field prefix length
+ * Set field prefix length.
+ *
+ * @param string $field
+ * @param int $prefixLength
*
- * @param string $field
- * @param int $prefixLength
- * @return \Elastica\Query\Match
+ * @return $this
*/
public function setFieldPrefixLength($field, $prefixLength)
{
@@ -159,11 +180,12 @@ class Match extends AbstractQuery
}
/**
- * Set field max expansions
+ * Set field max expansions.
+ *
+ * @param string $field
+ * @param int $maxExpansions
*
- * @param string $field
- * @param int $maxExpansions
- * @return \Elastica\Query\Match
+ * @return $this
*/
public function setFieldMaxExpansions($field, $maxExpansions)
{
@@ -171,13 +193,14 @@ class Match extends AbstractQuery
}
/**
- * Set zero terms query
+ * Set zero terms query.
*
* If not set, default to 'none'
*
- * @param string $field
- * @param string $zeroTermQuery
- * @return \Elastica\Query\Match
+ * @param string $field
+ * @param string $zeroTermQuery
+ *
+ * @return $this
*/
public function setFieldZeroTermsQuery($field, $zeroTermQuery = 'none')
{
@@ -185,11 +208,12 @@ class Match extends AbstractQuery
}
/**
- * Set cutoff frequency
+ * Set cutoff frequency.
+ *
+ * @param string $field
+ * @param float $cutoffFrequency
*
- * @param string $field
- * @param float $cutoffFrequency
- * @return \Elastica\Query\Match
+ * @return $this
*/
public function setFieldCutoffFrequency($field, $cutoffFrequency)
{