@@ 254-261 (lines=8) @@ | ||
251 | * @return \PaginatedList SilverStripe DataObjects returned from the search against ElasticSearch |
|
252 | */ |
|
253 | public function search($queryText, $fieldsToSearch = null, $testMode = false) { |
|
254 | if ($this->locale == null) { |
|
255 | if (class_exists('Translatable') && \SiteTree::has_extension('Translatable')) { |
|
256 | $this->locale = \Translatable::get_current_locale(); |
|
257 | } else { |
|
258 | // if no translatable we only have the default locale |
|
259 | $this->locale = \i18n::default_locale(); |
|
260 | } |
|
261 | } |
|
262 | ||
263 | $qg = new QueryGenerator(); |
|
264 | $qg->setQueryText($queryText); |
|
@@ 321-328 (lines=8) @@ | ||
318 | * @param string $queryText |
|
319 | */ |
|
320 | public function autocomplete_search($queryText, $field) { |
|
321 | if ($this->locale == null) { |
|
322 | if (class_exists('Translatable') && \SiteTree::has_extension('Translatable')) { |
|
323 | $this->locale = \Translatable::get_current_locale(); |
|
324 | } else { |
|
325 | // if no translatable we only have the default locale |
|
326 | $this->locale = \i18n::default_locale(); |
|
327 | } |
|
328 | } |
|
329 | ||
330 | $qg = new QueryGenerator(); |
|
331 | $qg->setQueryText($queryText); |
|
@@ 384-391 (lines=8) @@ | ||
381 | throw new \InvalidArgumentException('Fields cannot be null'); |
|
382 | } |
|
383 | ||
384 | if ($this->locale == null) { |
|
385 | if (class_exists('Translatable') && \SiteTree::has_extension('Translatable')) { |
|
386 | $this->locale = \Translatable::get_current_locale(); |
|
387 | } else { |
|
388 | // if no translatable we only have the default locale |
|
389 | $this->locale = \i18n::default_locale(); |
|
390 | } |
|
391 | } |
|
392 | ||
393 | $weightedFieldsArray = array(); |
|
394 | foreach ($fieldsToSearch as $field => $weighting) { |