|
|
|
@ -50,7 +50,7 @@ class RoblibSearchSolrsiteController extends ControllerBase {
|
|
|
|
|
} |
|
|
|
|
$queryString = urlencode($queryString); |
|
|
|
|
// 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(); |
|
|
|
|
|
|
|
|
|
// Change the parse mode for the search. |
|
|
|
@ -81,8 +81,12 @@ class RoblibSearchSolrsiteController extends ControllerBase {
|
|
|
|
|
$output['results'] = []; |
|
|
|
|
foreach ($results as $result) { |
|
|
|
|
$id = $result->getId(); |
|
|
|
|
$titles = $result->getField('title')->getValues(); |
|
|
|
|
$output['results'][$id]['title'] = $titles[0]->getText(); |
|
|
|
|
$title = $result->getField('title'); |
|
|
|
|
if(empty($title)){ |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
$titles = $title->getValues(); |
|
|
|
|
$output['results'][$id]['title'] = reset($titles); |
|
|
|
|
$body = $result->getField('body')->getValues(); |
|
|
|
|
if (!empty($body)) { |
|
|
|
|
$bodyOutput = strip_tags($body[0]->getText()); |
|
|
|
|