Skip to content

Commit

Permalink
Normalize int fields properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
EreMaijala committed Jan 10, 2025
1 parent 91836d5 commit 87567a6
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/RecordManager/Base/Solr/SolrUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
use function defined;
use function in_array;
use function is_array;
use function is_string;
use function strlen;

/**
Expand Down Expand Up @@ -2401,11 +2402,13 @@ protected function normalizeFields(array &$data)
foreach ($data as $key => &$values) {
if (is_array($values)) {
foreach ($values as $key2 => &$value) {
$value = $this->metadataUtils->normalizeUnicode(
$value,
$this->unicodeNormalizationForm
);
$value = $this->trimFieldLength($key, $value);
if (is_string($value)) {
$value = $this->metadataUtils->normalizeUnicode(
$value,
$this->unicodeNormalizationForm
);
$value = $this->trimFieldLength($key, $value);
}
if (in_array($value, $this->nonIndexedValues, true)) {
unset($values[$key2]);
}
Expand All @@ -2416,11 +2419,13 @@ protected function normalizeFields(array &$data)
$values = array_values(array_unique($values));
}
} elseif ($key !== 'fullrecord') {
$values = $this->metadataUtils->normalizeUnicode(
$values,
$this->unicodeNormalizationForm
);
$values = $this->trimFieldLength($key, $values);
if (is_string($values)) {
$values = $this->metadataUtils->normalizeUnicode(
$values,
$this->unicodeNormalizationForm
);
$values = $this->trimFieldLength($key, $values);
}

if (in_array($values, $this->nonIndexedValues, true)) {
unset($data[$key]);
Expand Down

0 comments on commit 87567a6

Please sign in to comment.