summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php180
1 files changed, 180 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php b/vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php
new file mode 100644
index 00000000..ac2d01b3
--- /dev/null
+++ b/vendor/ruflin/elastica/lib/Elastica/Query/MultiMatch.php
@@ -0,0 +1,180 @@
+<?php
+
+namespace Elastica\Query;
+
+/**
+ * Multi Match
+ *
+ * @category Xodoa
+ * @package Elastica
+ * @author Rodolfo Adhenawer Campagnoli Moraes <adhenawer@gmail.com>
+ * @author Wong Wing Lun <luiges90@gmail.com>
+ * @author Tristan Maindron <tmaindron@gmail.com>
+ * @link http://www.elasticsearch.org/guide/reference/query-dsl/multi-match-query.html
+ */
+class MultiMatch extends AbstractQuery
+{
+ const TYPE_BEST_FIELDS = 'best_fields';
+ const TYPE_MOST_FIELDS = 'most_fields';
+ const TYPE_CROSS_FIELDS = 'cross_fields';
+ const TYPE_PHRASE = 'phrase';
+ const TYPE_PHRASE_PREFIX = 'phrase_prefix';
+
+ const OPERATOR_OR = 'or';
+ const OPERATOR_AND = 'and';
+
+ const ZERO_TERM_NONE = 'none';
+ const ZERO_TERM_ALL = 'all';
+
+ /**
+ * Sets the query
+ *
+ * @param string $query Query
+ * @return \Elastica\Query\MultiMatch Current object
+ */
+ public function setQuery($query = '')
+ {
+ return $this->setParam('query', $query);
+ }
+
+ /**
+ * Sets Fields to be used in the query.
+ *
+ * @param array $fields Fields
+ * @return \Elastica\Query\MultiMatch Current object
+ */
+ public function setFields($fields = array())
+ {
+ return $this->setParam('fields', $fields);
+ }
+
+ /**
+ * Sets use dis max indicating to either create a dis_max query or a bool query.
+ *
+ * If not set, defaults to true.
+ *
+ * @param boolean $useDisMax
+ * @return \Elastica\Query\MultiMatch Current object
+ */
+ public function setUseDisMax($useDisMax = true)
+ {
+ return $this->setParam('use_dis_max', $useDisMax);
+ }
+
+ /**
+ * Sets tie breaker to multiplier value to balance the scores between lower and higher scoring fields.
+ *
+ * If not set, defaults to 0.0.
+ *
+ * @param float $tieBreaker
+ * @return \Elastica\Query\MultiMatch Current object
+ */
+ public function setTieBreaker($tieBreaker = 0.0)
+ {
+ return $this->setParam('tie_breaker', $tieBreaker);
+ }
+
+ /**
+ * Sets operator for Match Query
+ *
+ * If not set, defaults to 'or'
+ *
+ * @param string $operator
+ * @return \Elastica\Query\MultiMatch Current object
+ */
+ public function setOperator($operator = 'or')
+ {
+ return $this->setParam('operator', $operator);
+ }
+
+ /**
+ * Set field minimum should match for Match Query
+ *
+ * @param int $minimumShouldMatch
+ * @return \Elastica\Query\Match
+ */
+ public function setMinimumShouldMatch($minimumShouldMatch)
+ {
+ return $this->setParam('minimum_should_match', (int) $minimumShouldMatch);
+ }
+
+ /**
+ * Set zero terms query for Match Query
+ *
+ * If not set, default to 'none'
+ *
+ * @param string $zeroTermQuery
+ * @return \Elastica\Query\Match
+ */
+ public function setZeroTermsQuery($zeroTermQuery = 'none')
+ {
+ return $this->setParam('zero_terms_query', $zeroTermQuery);
+ }
+
+ /**
+ * Set cutoff frequency for Match Query
+ *
+ * @param float $cutoffFrequency
+ * @return \Elastica\Query\Match
+ */
+ public function setCutoffFrequency($cutoffFrequency)
+ {
+ return $this->setParam('cutoff_frequency', $cutoffFrequency);
+ }
+
+ /**
+ * Set type
+ *
+ * @param string $field
+ * @param string $type
+ * @return \Elastica\Query\Match
+ */
+ public function setType($type)
+ {
+ return $this->setParam('type', $type);
+ }
+
+ /**
+ * Set fuzziness
+ *
+ * @param float $fuzziness
+ * @return \Elastica\Query\Match
+ */
+ public function setFuzziness($fuzziness)
+ {
+ return $this->setParam('fuzziness', (float) $fuzziness);
+ }
+
+ /**
+ * Set prefix length
+ *
+ * @param int $prefixLength
+ * @return \Elastica\Query\Match
+ */
+ public function setPrefixLength($prefixLength)
+ {
+ return $this->setParam('prefix_length', (int) $prefixLength);
+ }
+
+ /**
+ * Set max expansions
+ *
+ * @param int $maxExpansions
+ * @return \Elastica\Query\Match
+ */
+ public function setMaxExpansions($maxExpansions)
+ {
+ return $this->setParam('max_expansions', (int) $maxExpansions);
+ }
+
+ /**
+ * Set analyzer
+ *
+ * @param string $analyzer
+ * @return \Elastica\Query\Match
+ */
+ public function setAnalyzer($analyzer)
+ {
+ return $this->setParam('analyzer', $analyzer);
+ }
+}