Skip to content
Snippets Groups Projects
Commit 8f954264 authored by Frank Morgner's avatar Frank Morgner
Browse files

refs #15110 [master-v5] - modify Solr lookup to k10plus for creating link if...

refs #15110 [master-v5] - modify Solr lookup to k10plus for creating link if exists by 'Gesamtaufnahme'
parent 181d04a2
No related merge requests found
...@@ -1665,21 +1665,27 @@ trait SolrMarcFincTrait ...@@ -1665,21 +1665,27 @@ trait SolrMarcFincTrait
$idRetrieval = function ($value) { $idRetrieval = function ($value) {
// use preg_match to get rid of the isil // 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])) { if (!empty($matches[2])) {
$query = 'record_id:' . $matches[2]; $query = 'kxp_id_str:' . $matches[2];
if ($sid = $this->fields['source_id']) { if ($sid = $this->fields['source_id']) {
$query .= ' AND source_id:'.$sid; $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) { 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 null;
} }
return current($result->getRecords())->getUniqueId(); return current($result->getRecords())->getUniqueId();
} }
$this->debug( $this->debug(
'Pregmatch pattern in getHierarchyParentID failed for ' . $value 'Pregmatch pattern in getHierarchyParentID failed for '
. $value
); );
return $value; return $value;
}; };
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment