Lines Matching refs:query

16  * Elastica query object.
52 * query?: AbstractQuery|array<string, array<string, mixed>>,
69 * If the current query has a suggest in it.
76 * Creates a query object.
78 * @param AbstractQuery|array|Collapse|Suggest $query Query object (default = null)
79 * @phpstan-param AbstractQuery|Suggest|Collapse|TRawQuery $query
81 public function __construct($query = null)
83 if (\is_array($query)) {
84 $this->setRawQuery($query);
85 } elseif ($query instanceof AbstractQuery) {
86 $this->setQuery($query);
87 } elseif ($query instanceof Suggest) {
88 $this->setSuggest($query);
89 } elseif ($query instanceof Collapse) {
90 $this->setCollapse($query);
95 * Transforms the argument to a query object.
99 * @param AbstractQuery|AbstractSuggest|array|Collapse|Query|string|Suggest|null $query
100 * @phpstan-param TCreateQueryArgs $query
104 public static function create($query): self
107 case empty($query):
109 case $query instanceof self:
110 return $query;
111 case $query instanceof AbstractSuggest:
112 return new static(new Suggest($query));
113 case $query instanceof AbstractQuery:
114 case $query instanceof Suggest:
115 case $query instanceof Collapse:
116 case \is_array($query):
117 return new static($query);
118 case \is_string($query):
119 return new static(new QueryString($query));
122 throw new InvalidException('Unexpected argument to create a query for.');
126 * Sets query as raw array. Will overwrite all already set arguments.
128 * @param array $query Query array
129 * @phpstan-param TRawQuery $query
131 public function setRawQuery(array $query): self
133 $this->_params = $query;
138 public function setQuery(AbstractQuery $query): self
140 return $this->setParam('query', $query);
144 * Gets the query object.
150 return $this->getParam('query');
164 * Sets sort arguments for the query
178 * Adds a sort param to the query.
201 * Sets highlight arguments for the query.
226 * Sets maximum number of results for this query.
228 * @param int $size Maximal number of results for query (default = 10)
238 * Enables explain on the query.
250 * Enables version on the query.
306 * Adds a Script to the query.
320 * Adds an Aggregation to the query.
330 * Converts all query params to an array.
334 if (!$this->hasSuggest && !isset($this->_params['query'])) {
417 * Sets a post_filter to the current query.
437 * Set the Point-in-Time used for the query.