From 473c8748f62fcff742d01cfa7306def203106ca7 Mon Sep 17 00:00:00 2001 From: dalar063 Date: Thu, 19 Dec 2024 15:56:14 +0000 Subject: [PATCH] Add prefix to the checksum field to prevent conflicts with other field mappings of the same name --- src/Service.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Service.php b/src/Service.php index f4a93a8..911d83e 100644 --- a/src/Service.php +++ b/src/Service.php @@ -407,7 +407,7 @@ public function getIndexData(Concrete $object) } $checksum = crc32(json_encode($data)); - $data['checksum'] = $checksum; + $data[$this->indexNamePrefix.'checksum'] = $checksum; return [ 'index' => $this->getIndexName($object->getClassName()), @@ -439,7 +439,7 @@ public function doUpdateIndexData(Concrete $object, $ignoreUpdateQueue = false) try { $indexDocument = $this->getClient()->get($params); - $originalChecksum = $indexDocument['_source']['checksum'] ?? -1; + $originalChecksum = $indexDocument['_source'][$this->indexNamePrefix.'checksum'] ?? -1; } catch (Exception $e) { $this->logger->debug($e->getMessage()); $originalChecksum = -1; @@ -447,7 +447,7 @@ public function doUpdateIndexData(Concrete $object, $ignoreUpdateQueue = false) $indexUpdateParams = $this->getIndexData($object); - if ($indexUpdateParams['body']['checksum'] != $originalChecksum) { + if ($indexUpdateParams['body'][$this->indexNamePrefix.'checksum'] != $originalChecksum) { $this->getClient()->index($indexUpdateParams); $this->logger->info('Updates es index for data object ' . $object->getId()); $this->getClient()->index($indexUpdateParams);