Skip to content

Commit

Permalink
[FINNA-819] LIDO: Add hierarchy titles from relatedWorksWrap to allfi…
Browse files Browse the repository at this point in the history
…elds.
  • Loading branch information
EreMaijala committed Nov 13, 2023
1 parent 0b644b4 commit 94eb894
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/RecordManager/Base/Record/Lido.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,21 @@ public function toSolrArray(Database $db = null)

$data['allfields'] = $this->getAllFields($this->doc);

// Include hierarchy titles from relatedWorksWrap:
foreach (
['is_hierarchy_title', 'hierarchy_parent_title', 'hierarchy_top_title', 'title_in_hierarchy'] as $field
) {
// phpcs:ignore
/** @psalm-var list<string> */
$titles = (array)($data[$field] ?? []);
if ($titles) {
$data['allfields'] = [
...$data['allfields'],
...$titles,
];
}
}

return $data;
}

Expand Down

0 comments on commit 94eb894

Please sign in to comment.