|
@@ -244,7 +244,7 @@ discard block |
|
|
block discarded – undo |
|
244
|
244
|
* e.g. array('Title' => array('Weight' => 2, 'Type' => 'string')) |
|
245
|
245
|
* @return ArrayList SilverStripe DataObjects returned from the search against ElasticSearch |
|
246
|
246
|
*/ |
|
247
|
|
- public function search($queryText, $fieldsToSearch = null, $testMode = false) { |
|
|
247
|
+ public function search($queryText, $fieldsToSearch = null, $testMode = false) { |
|
248
|
248
|
if ($this->locale == null) { |
|
249
|
249
|
if (class_exists('Translatable') && \SiteTree::has_extension('Translatable')) { |
|
250
|
250
|
$this->locale = \Translatable::get_current_locale(); |
|
@@ -365,14 +365,14 @@ discard block |
|
|
block discarded – undo |
|
365
|
365
|
* @return resultList List of results |
|
366
|
366
|
*/ |
|
367
|
367
|
public function moreLikeThis($indexedItem, $fieldsToSearch, $testMode = false) { |
|
368
|
|
- echo "INDEXED ITEM:".$indexedItem; |
|
|
368
|
+ echo "INDEXED ITEM:" . $indexedItem; |
|
369
|
369
|
|
|
370
|
370
|
if ($indexedItem == null) { |
|
371
|
371
|
throw new \InvalidArgumentException('A searchable item cannot be null'); |
|
372
|
372
|
} |
|
373
|
373
|
|
|
374
|
374
|
if (!$indexedItem->hasExtension('SilverStripe\Elastica\Searchable')) { |
|
375
|
|
- throw new \InvalidArgumentException('Objects of class '.$indexedItem->ClassName.' are not searchable'); |
|
|
375
|
+ throw new \InvalidArgumentException('Objects of class ' . $indexedItem->ClassName . ' are not searchable'); |
|
376
|
376
|
} |
|
377
|
377
|
|
|
378
|
378
|
if ($fieldsToSearch == null) { |
|
@@ -396,7 +396,7 @@ discard block |
|
|
block discarded – undo |
|
396
|
396
|
if (!is_numeric($weighting)) { |
|
397
|
397
|
throw new \InvalidArgumentException('Fields must be of the form fieldname => weight'); |
|
398
|
398
|
} |
|
399
|
|
- $weightedField = $field.'^'.$weighting; |
|
|
399
|
+ $weightedField = $field . '^' . $weighting; |
|
400
|
400
|
$weightedField = str_replace('^1', '', $weightedField); |
|
401
|
401
|
array_push($weightedFieldsArray, $weightedField); |
|
402
|
402
|
} |