From 534a507355ded268504003c1e6183083db6f754d Mon Sep 17 00:00:00 2001 From: BFallert Date: Thu, 7 Nov 2024 18:34:32 +0100 Subject: [PATCH] fix search from startpage --- Classes/Common/Solr/SolrSearch.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Classes/Common/Solr/SolrSearch.php b/Classes/Common/Solr/SolrSearch.php index ed6389a5b..3e3db19a7 100644 --- a/Classes/Common/Solr/SolrSearch.php +++ b/Classes/Common/Solr/SolrSearch.php @@ -252,7 +252,7 @@ public function offsetGet($offset) $partOfPartOf = AbstractDocument::getPartOf($document['partOf'], true); $document['partOfP'] = $partOfPartOf; $superiorTitleP = AbstractDocument::getTitle($partOfPartOf, true); - $document['partOfPT'] = '[' . $superiorTitleP . ']'; + $document['partOfPT'] = '[' . $superiorTitleP . ']'; } } } @@ -560,21 +560,21 @@ public function submit($start, $rows, $processResults = true) if (!array_key_exists('fulltext', $this->searchParams) || $this->searchParams['fulltext'] != '1') { $documents[$doc['uid']]['page'] = 1; $children = $childrenOf[$doc['uid']] ?? []; - + if (!empty($children)) { $batchSize = 100; $totalChildren = count($children); - + for ($start = 0; $start < $totalChildren; $start += $batchSize) { $batch = array_slice($children, $start, $batchSize, true); - + // Fetch metadata for the current batch $metadataOf = $this->fetchToplevelMetadataFromSolr([ 'query' => 'partof:' . $doc['uid'], 'start' => $start, 'rows' => min($batchSize, $totalChildren - $start), ]); - + foreach ($batch as $docChild) { // We need only a few fields from the children, but we need them as an array. $childDocument = [ @@ -852,7 +852,7 @@ private function getDocument(Document $record, array $highlighting, array $field 'uid' => !empty($resultDocument->getUid()) ? $resultDocument->getUid() : $parameters['uid'], 'highlight' => $resultDocument->getHighlightsIds(), ]; - + foreach ($parameters['listMetadataRecords'] as $indexName => $solrField) { if (!empty($record->$solrField)) { $document['metadata'][$indexName] = $record->$solrField; @@ -873,7 +873,7 @@ private function getDocument(Document $record, array $highlighting, array $field */ private function translateLanguageCode(&$doc): void { - if (array_key_exists('language', $doc['metadata'])) { + if (is_array($doc['metadata']) && array_key_exists('language', $doc['metadata'])) { foreach($doc['metadata']['language'] as $indexName => $language) { $doc['metadata']['language'][$indexName] = Helper::getLanguageName($language); }