Skip to content

Commit

Permalink
Do not assume ES cast interger to boolean anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurélien FOUCRET committed Feb 6, 2018
1 parent 2943e19 commit 6450515
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/module-elasticsuite-catalog/Helper/AbstractAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
18 changes: 9 additions & 9 deletions src/module-elasticsuite-core/etc/elasticsuite_analysis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
<filter name="trim" type="trim" language="default"/>
<filter name="lowercase" type="lowercase" language="default"/>
<filter name="word_delimiter" type="word_delimiter" language="default">
<generate_word_parts>1</generate_word_parts>
<catenate_words>1</catenate_words>
<catenate_numbers>1</catenate_numbers>
<catenate_all>1</catenate_all>
<split_on_case_change>1</split_on_case_change>
<split_on_numerics>1</split_on_numerics>
<preserve_original>1</preserve_original>
<generate_word_parts>true</generate_word_parts>
<catenate_words>true</catenate_words>
<catenate_numbers>true</catenate_numbers>
<catenate_all>true</catenate_all>
<split_on_case_change>true</split_on_case_change>
<split_on_numerics>true</split_on_numerics>
<preserve_original>true</preserve_original>
</filter>
<filter name="shingle" type="shingle" language="default">
<min_shingle_size>2</min_shingle_size>
<max_shingle_size>2</max_shingle_size>
<output_unigrams>0</output_unigrams>
<output_unigrams>false</output_unigrams>
</filter>
<filter name="ascii_folding" type="asciifolding" language="default">
<preserve_original>0</preserve_original>
<preserve_original>false</preserve_original>
</filter>
<filter name="standard" type="standard" language="default" />
<filter name="standard" type="stemmer" language="ar">
Expand Down

0 comments on commit 6450515

Please sign in to comment.