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