diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
commit | 6dc1997577fab2c366781fd7048144935afa0012 (patch) | |
tree | 8918d28c7ab4342f0738985e37af1dfc42d0e93a /vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php | |
parent | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff) | |
parent | fa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff) |
Merge commit 'fa89acd'
# Conflicts:
# .gitignore
# extensions/ArchInterWiki.sql
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php b/vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php new file mode 100644 index 00000000..c2302d44 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php @@ -0,0 +1,83 @@ +<?php +namespace Elastica\Query; + +/** + * Class SimpleQueryString. + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html + */ +class SimpleQueryString extends AbstractQuery +{ + const OPERATOR_AND = 'and'; + const OPERATOR_OR = 'or'; + + /** + * @param string $query + * @param array $fields + */ + public function __construct($query, array $fields = array()) + { + $this->setQuery($query); + if (sizeof($fields)) { + $this->setFields($fields); + } + } + + /** + * Set the querystring for this query. + * + * @param string $query see ES documentation for querystring syntax + * + * @return $this + */ + public function setQuery($query) + { + return $this->setParam('query', $query); + } + + /** + * @param string[] $fields the fields on which to perform this query. Defaults to index.query.default_field. + * + * @return $this + */ + public function setFields(array $fields) + { + return $this->setParam('fields', $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 $this + */ + public function setDefaultOperator($operator) + { + return $this->setParam('default_operator', $operator); + } + + /** + * Set the analyzer used to analyze each term of the query. + * + * @param string $analyzer + * + * @return $this + */ + public function setAnalyzer($analyzer) + { + return $this->setParam('analyzer', $analyzer); + } + + /** + * Set minimum_should_match option. + * + * @param int|string $minimumShouldMatch + * + * @return $this + */ + public function setMinimumShouldMatch($minimumShouldMatch) + { + return $this->setParam('minimum_should_match', $minimumShouldMatch); + } +} |