| @@ 9-47 (lines=39) @@ | ||
| 6 | * |
|
| 7 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html |
|
| 8 | */ |
|
| 9 | class Prefix extends AbstractQuery |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * Constructs the Prefix query object. |
|
| 13 | * |
|
| 14 | * @param array $prefix OPTIONAL Calls setRawPrefix with the given $prefix array |
|
| 15 | */ |
|
| 16 | public function __construct(array $prefix = []) |
|
| 17 | { |
|
| 18 | $this->setRawPrefix($prefix); |
|
| 19 | } |
|
| 20 | ||
| 21 | /** |
|
| 22 | * setRawPrefix can be used instead of setPrefix if some more special |
|
| 23 | * values for a prefix have to be set. |
|
| 24 | * |
|
| 25 | * @param array $prefix Prefix array |
|
| 26 | * |
|
| 27 | * @return $this |
|
| 28 | */ |
|
| 29 | public function setRawPrefix(array $prefix) |
|
| 30 | { |
|
| 31 | return $this->setParams($prefix); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Adds a prefix to the prefix query. |
|
| 36 | * |
|
| 37 | * @param string $key Key to query |
|
| 38 | * @param string|array $value Values(s) for the query. Boost can be set with array |
|
| 39 | * @param float $boost OPTIONAL Boost value (default = 1.0) |
|
| 40 | * |
|
| 41 | * @return $this |
|
| 42 | */ |
|
| 43 | public function setPrefix($key, $value, $boost = 1.0) |
|
| 44 | { |
|
| 45 | return $this->setRawPrefix([$key => ['value' => $value, 'boost' => $boost]]); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||
| @@ 11-49 (lines=39) @@ | ||
| 8 | * |
|
| 9 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html |
|
| 10 | */ |
|
| 11 | class Term extends AbstractQuery |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * Constructs the Term query object. |
|
| 15 | * |
|
| 16 | * @param array $term OPTIONAL Calls setTerm with the given $term array |
|
| 17 | */ |
|
| 18 | public function __construct(array $term = []) |
|
| 19 | { |
|
| 20 | $this->setRawTerm($term); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Set term can be used instead of addTerm if some more special |
|
| 25 | * values for a term have to be set. |
|
| 26 | * |
|
| 27 | * @param array $term Term array |
|
| 28 | * |
|
| 29 | * @return $this |
|
| 30 | */ |
|
| 31 | public function setRawTerm(array $term) |
|
| 32 | { |
|
| 33 | return $this->setParams($term); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * Adds a term to the term query. |
|
| 38 | * |
|
| 39 | * @param string $key Key to query |
|
| 40 | * @param string|array $value Values(s) for the query. Boost can be set with array |
|
| 41 | * @param float $boost OPTIONAL Boost value (default = 1.0) |
|
| 42 | * |
|
| 43 | * @return $this |
|
| 44 | */ |
|
| 45 | public function setTerm($key, $value, $boost = 1.0) |
|
| 46 | { |
|
| 47 | return $this->setRawTerm([$key => ['value' => $value, 'boost' => $boost]]); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 12-50 (lines=39) @@ | ||
| 9 | * |
|
| 10 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-term-query.html |
|
| 11 | */ |
|
| 12 | class SpanTerm extends AbstractSpanQuery |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * Constructs the SpanTerm query object. |
|
| 16 | * |
|
| 17 | * @param array $term OPTIONAL Calls setRawTerm with the given $term array |
|
| 18 | */ |
|
| 19 | public function __construct(array $term = []) |
|
| 20 | { |
|
| 21 | $this->setRawTerm($term); |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Set term can be used instead of setTerm if some more special |
|
| 26 | * values for a term have to be set. |
|
| 27 | * |
|
| 28 | * @param array $term Term array |
|
| 29 | * |
|
| 30 | * @return $this |
|
| 31 | */ |
|
| 32 | public function setRawTerm(array $term) |
|
| 33 | { |
|
| 34 | return $this->setParams($term); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Adds a term to the term query. |
|
| 39 | * |
|
| 40 | * @param string $key Key to query |
|
| 41 | * @param string|array $value Values(s) for the query. Boost can be set with array |
|
| 42 | * @param float $boost OPTIONAL Boost value (default = 1.0) |
|
| 43 | * |
|
| 44 | * @return $this |
|
| 45 | */ |
|
| 46 | public function setTerm($key, $value, $boost = 1.0) |
|
| 47 | { |
|
| 48 | return $this->setRawTerm([$key => ['value' => $value, 'boost' => $boost]]); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||