From 975a790be9c524d16dfa2c9e3ec8b942db11dad2 Mon Sep 17 00:00:00 2001 From: mshroom <32199029+mshroom@users.noreply.github.com> Date: Wed, 7 Jan 2026 15:36:46 +0200 Subject: [PATCH 1/2] AIPA: Add topic ids to index and enrichment --- src/RecordManager/Finna/Record/Aipa.php | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/RecordManager/Finna/Record/Aipa.php b/src/RecordManager/Finna/Record/Aipa.php index 2c787ca4..0cb94506 100644 --- a/src/RecordManager/Finna/Record/Aipa.php +++ b/src/RecordManager/Finna/Record/Aipa.php @@ -47,6 +47,7 @@ */ class Aipa extends Qdc { + use AuthoritySupportTrait; use CreateRecordTrait; /** @@ -116,6 +117,7 @@ public function toSolrArray(?Database $db = null) $data['record_format'] = 'aipa'; $data['educational_material_type_str_mv'] = $this->getFormat(); + $data['topic_id_str_mv'] = $this->getTopicIDs(); // Merge fields from encapsulated records. foreach ($this->doc->item as $item) { @@ -154,6 +156,32 @@ public function getFormat() return (string)($this->doc->type); } + /** + * Get all topic identifiers (for enrichment) + * + * @return array + */ + public function getRawTopicIds(): array + { + return $this->getTopicIDs(); + } + + /** + * Return subject identifiers associated with object. + * + * @return array + */ + protected function getTopicIDs(): array + { + $results = []; + foreach ($this->doc->subject ?? [] as $subject) { + if ($id = trim((string)($subject->attributes()->identifier))) { + $results[] = $id; + } + } + return array_unique($this->addNamespaceToAuthorityIds($results, 'topic')); + } + /** * Return URLs associated with object * From 93ca22689890a9b37972a0d27f4b81ac4672ea10 Mon Sep 17 00:00:00 2001 From: mshroom <32199029+mshroom@users.noreply.github.com> Date: Wed, 7 Jan 2026 15:58:42 +0200 Subject: [PATCH 2/2] do not add namespaces in raw topic ids --- src/RecordManager/Finna/Record/Aipa.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/RecordManager/Finna/Record/Aipa.php b/src/RecordManager/Finna/Record/Aipa.php index 0cb94506..b724ddf2 100644 --- a/src/RecordManager/Finna/Record/Aipa.php +++ b/src/RecordManager/Finna/Record/Aipa.php @@ -163,7 +163,13 @@ public function getFormat() */ public function getRawTopicIds(): array { - return $this->getTopicIDs(); + $results = []; + foreach ($this->doc->subject ?? [] as $subject) { + if ($id = trim((string)($subject->attributes()->identifier))) { + $results[] = $id; + } + } + return array_unique($results); } /** @@ -173,13 +179,7 @@ public function getRawTopicIds(): array */ protected function getTopicIDs(): array { - $results = []; - foreach ($this->doc->subject ?? [] as $subject) { - if ($id = trim((string)($subject->attributes()->identifier))) { - $results[] = $id; - } - } - return array_unique($this->addNamespaceToAuthorityIds($results, 'topic')); + return $this->addNamespaceToAuthorityIds($this->getRawTopicIDs(), 'topic'); } /**