@@ 131-142 (lines=12) @@ | ||
128 | * @param $text - поисковая фраза |
|
129 | * @return SearchQuery; |
|
130 | */ |
|
131 | public function match($text) |
|
132 | { |
|
133 | if (is_array($this->field)) { |
|
134 | $this->query->addFilter('multi_match', [ |
|
135 | 'query' => $text, |
|
136 | 'fields' => $this->field |
|
137 | ]); |
|
138 | } else { |
|
139 | $this->query->addFilter('match', [$this->field => $text]); |
|
140 | } |
|
141 | return $this->query; |
|
142 | } |
|
143 | ||
144 | /** |
|
145 | * Поле существует и имеет не null значение |
|
@@ 199-210 (lines=12) @@ | ||
196 | * @param $text |
|
197 | * @return SearchQuery |
|
198 | */ |
|
199 | public function notMatch($text) |
|
200 | { |
|
201 | if (is_array($this->field)) { |
|
202 | $this->query->addNotFilter('multi_match', [ |
|
203 | 'query' => $text, |
|
204 | 'fields' => $this->field |
|
205 | ]); |
|
206 | } else { |
|
207 | $this->query->addNotFilter('match', [$this->field => $text]); |
|
208 | } |
|
209 | return $this->query; |
|
210 | } |
|
211 | ||
212 | /** |
|
213 | * @return SearchQuery |