Skip to content

Commit

Permalink
fix search from startpage
Browse files Browse the repository at this point in the history
  • Loading branch information
BFallert committed Nov 7, 2024
1 parent 3f30a97 commit 7fc9823
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Classes/Common/Solr/SolrSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . ']';
}
}
}
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit 7fc9823

Please sign in to comment.