From 6450515abe7fb4f08b98dc11034ebba0b108fc4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20FOUCRET?= Date: Tue, 6 Feb 2018 16:26:50 +0100 Subject: [PATCH] Do not assume ES cast interger to boolean anymore --- .../Helper/AbstractAttribute.php | 4 +++- .../Product/Indexer/Fulltext/Action/Full.php | 2 ++ .../etc/elasticsuite_analysis.xml | 18 +++++++++--------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/module-elasticsuite-catalog/Helper/AbstractAttribute.php b/src/module-elasticsuite-catalog/Helper/AbstractAttribute.php index b214fbdc6..a46f18507 100644 --- a/src/module-elasticsuite-catalog/Helper/AbstractAttribute.php +++ b/src/module-elasticsuite-catalog/Helper/AbstractAttribute.php @@ -266,7 +266,9 @@ public function getFilterField(AttributeInterface $attribute) */ private function prepareSimpleIndexAttributeValue(AttributeInterface $attribute, $value) { - if ($attribute->getBackendType() == 'decimal') { + if ($this->getFieldType($attribute) == FieldInterface::FIELD_TYPE_BOOLEAN) { + $value = boolval($value); + } elseif ($attribute->getBackendType() == 'decimal') { $value = floatval($value); } elseif ($attribute->getBackendType() == 'int') { $value = intval($value); diff --git a/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Action/Full.php b/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Action/Full.php index 8eb81ad29..62c911b6c 100644 --- a/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Action/Full.php +++ b/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Action/Full.php @@ -63,6 +63,8 @@ public function rebuildStoreIndex($storeId, $productIds = null) foreach ($products as $productData) { $productId = (int) $productData['entity_id']; + $productData['has_options'] = (bool) $productData['has_options']; + $productData['required_options'] = (bool) $productData['required_options']; yield $productId => $productData; } } while (!empty($products)); diff --git a/src/module-elasticsuite-core/etc/elasticsuite_analysis.xml b/src/module-elasticsuite-core/etc/elasticsuite_analysis.xml index 62c62cd3a..ff806676b 100644 --- a/src/module-elasticsuite-core/etc/elasticsuite_analysis.xml +++ b/src/module-elasticsuite-core/etc/elasticsuite_analysis.xml @@ -27,21 +27,21 @@ - 1 - 1 - 1 - 1 - 1 - 1 - 1 + true + true + true + true + true + true + true 2 2 - 0 + false - 0 + false