From 124fac972801ec627952b4841a9714e59b2f1510 Mon Sep 17 00:00:00 2001
From: Frank Morgner <morgnerf@ub.uni-leipzig.de>
Date: Fri, 3 May 2019 09:22:26 +0200
Subject: [PATCH] refs #15110 [master] - modify Solr lookup to k10plus for
 creating link if exists by 'Gesamtaufnahme'

---
 .../finc/RecordDriver/SolrMarcFincTrait.php    | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php
index 4bc6c74ff8e..888c7e24e64 100644
--- a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php
+++ b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php
@@ -1665,21 +1665,27 @@ trait SolrMarcFincTrait
 
         $idRetrieval = function ($value) {
             // use preg_match to get rid of the isil
-            preg_match("/^(\([A-z]*-[A-z0-9]*\))?\s*([A-z0-9]*)\s*$/", $value, $matches);
+            preg_match(self::KXP_PATTERN, $value, $matches);
             if (!empty($matches[2])) {
-                $query = 'record_id:' . $matches[2];
+                $query = 'kxp_id_str:' . $matches[2];
                 if ($sid = $this->fields['source_id']) {
                     $query .= ' AND source_id:'.$sid;
                 }
-                $result = $this->searchService->search('Solr', new Query($query));
+                $result = $this->searchService->search(
+                    'Solr',
+                    new Query($query)
+                );
                 if (count($result) === 0) {
-                    $this->debug('Could not retrieve id for record with ' . $query);
+                    $this->debug(
+                        'Could not retrieve id for record with ' . $query
+                    );
                     return null;
                 }
                 return current($result->getRecords())->getUniqueId();
             }
-            $this->debug('Pregmatch pattern in getHierarchyParentID failed for ' .
-                $value
+            $this->debug(
+                'Pregmatch pattern in getHierarchyParentID failed for '
+                . $value
             );
             return $value;
         };
-- 
GitLab