|
|
@ -50,7 +50,7 @@ class RoblibSearchSolrsiteController extends ControllerBase { |
|
|
|
} |
|
|
|
} |
|
|
|
$queryString = urlencode($queryString); |
|
|
|
$queryString = urlencode($queryString); |
|
|
|
// TODO make the index configurable. |
|
|
|
// TODO make the index configurable. |
|
|
|
$index = \Drupal\search_api\Entity\Index::load('default_solr_index'); |
|
|
|
$index = \Drupal\search_api\Entity\Index::load('library'); |
|
|
|
$query = $index->query(); |
|
|
|
$query = $index->query(); |
|
|
|
|
|
|
|
|
|
|
|
// Change the parse mode for the search. |
|
|
|
// Change the parse mode for the search. |
|
|
@ -81,8 +81,12 @@ class RoblibSearchSolrsiteController extends ControllerBase { |
|
|
|
$output['results'] = []; |
|
|
|
$output['results'] = []; |
|
|
|
foreach ($results as $result) { |
|
|
|
foreach ($results as $result) { |
|
|
|
$id = $result->getId(); |
|
|
|
$id = $result->getId(); |
|
|
|
$titles = $result->getField('title')->getValues(); |
|
|
|
$title = $result->getField('title'); |
|
|
|
$output['results'][$id]['title'] = $titles[0]->getText(); |
|
|
|
if(empty($title)){ |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$titles = $title->getValues(); |
|
|
|
|
|
|
|
$output['results'][$id]['title'] = reset($titles); |
|
|
|
$body = $result->getField('body')->getValues(); |
|
|
|
$body = $result->getField('body')->getValues(); |
|
|
|
if (!empty($body)) { |
|
|
|
if (!empty($body)) { |
|
|
|
$bodyOutput = strip_tags($body[0]->getText()); |
|
|
|
$bodyOutput = strip_tags($body[0]->getText()); |
|
|
|