Skip to content

Commit a1a0af9

Browse files
committed
Merge remote-tracking branch 'origin/MC-35256' into 2.4-develop-pr32
2 parents d6b4a79 + cfee529 commit a1a0af9

File tree

11 files changed

+84
-18
lines changed

11 files changed

+84
-18
lines changed

app/code/Magento/Elasticsearch/Elasticsearch5/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Converter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Converter implements ConverterInterface
1919
*/
2020
private const ES_DATA_TYPE_TEXT = 'text';
2121
private const ES_DATA_TYPE_KEYWORD = 'keyword';
22-
private const ES_DATA_TYPE_FLOAT = 'float';
22+
private const ES_DATA_TYPE_DOUBLE = 'double';
2323
private const ES_DATA_TYPE_INT = 'integer';
2424
private const ES_DATA_TYPE_DATE = 'date';
2525
/**#@-*/
@@ -32,7 +32,7 @@ class Converter implements ConverterInterface
3232
private $mapping = [
3333
self::INTERNAL_DATA_TYPE_STRING => self::ES_DATA_TYPE_TEXT,
3434
self::INTERNAL_DATA_TYPE_KEYWORD => self::ES_DATA_TYPE_KEYWORD,
35-
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_FLOAT,
35+
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_DOUBLE,
3636
self::INTERNAL_DATA_TYPE_INT => self::ES_DATA_TYPE_INT,
3737
self::INTERNAL_DATA_TYPE_DATE => self::ES_DATA_TYPE_DATE,
3838
];

app/code/Magento/Elasticsearch/Elasticsearch5/Model/Client/Elasticsearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function addFieldsMapping(array $fields, $index, $entityType)
276276
'match' => 'price_*',
277277
'match_mapping_type' => 'string',
278278
'mapping' => [
279-
'type' => 'float',
279+
'type' => 'double',
280280
'store' => true,
281281
],
282282
],

app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Converter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Converter implements ConverterInterface
1616
* Text flags for Elasticsearch field types
1717
*/
1818
private const ES_DATA_TYPE_STRING = 'string';
19-
private const ES_DATA_TYPE_FLOAT = 'float';
19+
private const ES_DATA_TYPE_DOUBLE = 'double';
2020
private const ES_DATA_TYPE_INT = 'integer';
2121
private const ES_DATA_TYPE_DATE = 'date';
2222
/**#@-*/
@@ -29,7 +29,7 @@ class Converter implements ConverterInterface
2929
private $mapping = [
3030
self::INTERNAL_DATA_TYPE_STRING => self::ES_DATA_TYPE_STRING,
3131
self::INTERNAL_DATA_TYPE_KEYWORD => self::ES_DATA_TYPE_STRING,
32-
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_FLOAT,
32+
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_DOUBLE,
3333
self::INTERNAL_DATA_TYPE_INT => self::ES_DATA_TYPE_INT,
3434
self::INTERNAL_DATA_TYPE_DATE => self::ES_DATA_TYPE_DATE,
3535
];
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Elasticsearch\Setup\Patch\Data;
10+
11+
use Magento\Framework\Setup\ModuleDataSetupInterface;
12+
use Magento\Framework\Setup\Patch\DataPatchInterface;
13+
use Magento\Framework\Indexer\IndexerRegistry;
14+
use Magento\CatalogSearch\Model\Indexer\Fulltext as FulltextIndexer;
15+
use Magento\Framework\Setup\Patch\PatchInterface;
16+
17+
/**
18+
* Invalidate fulltext index
19+
*/
20+
class InvalidateIndex implements DataPatchInterface
21+
{
22+
/**
23+
* @var ModuleDataSetupInterface
24+
*/
25+
private $moduleDataSetup;
26+
27+
/**
28+
* @var IndexerRegistry
29+
*/
30+
private $indexerRegistry;
31+
32+
/**
33+
* @param ModuleDataSetupInterface $moduleDataSetup
34+
* @param IndexerRegistry $indexerRegistry
35+
*/
36+
public function __construct(ModuleDataSetupInterface $moduleDataSetup, IndexerRegistry $indexerRegistry)
37+
{
38+
$this->moduleDataSetup = $moduleDataSetup;
39+
$this->indexerRegistry = $indexerRegistry;
40+
}
41+
42+
/**
43+
* @inheritDoc
44+
*/
45+
public function apply(): PatchInterface
46+
{
47+
$this->indexerRegistry->get(FulltextIndexer::INDEXER_ID)->invalidate();
48+
return $this;
49+
}
50+
51+
/**
52+
* @inheritDoc
53+
*/
54+
public static function getDependencies(): array
55+
{
56+
return [];
57+
}
58+
59+
/**
60+
* @inheritDoc
61+
*/
62+
public function getAliases(): array
63+
{
64+
return [];
65+
}
66+
}

app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public function testAddFieldsMapping()
329329
'match' => 'price_*',
330330
'match_mapping_type' => 'string',
331331
'mapping' => [
332-
'type' => 'float',
332+
'type' => 'double',
333333
'store' => true,
334334
],
335335
],
@@ -400,7 +400,7 @@ public function testAddFieldsMappingFailure()
400400
'match' => 'price_*',
401401
'match_mapping_type' => 'string',
402402
'mapping' => [
403-
'type' => 'float',
403+
'type' => 'double',
404404
'store' => true,
405405
],
406406
],

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/DynamicFieldTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function ($type) use ($complexType) {
246246
if ($type === 'string') {
247247
return 'string';
248248
} elseif ($type === 'float') {
249-
return 'float';
249+
return 'double';
250250
} elseif ($type === 'integer') {
251251
return 'integer';
252252
} else {
@@ -281,7 +281,7 @@ public function attributeProvider()
281281
'index' => 'no_index'
282282
],
283283
'price_1_1' => [
284-
'type' => 'float',
284+
'type' => 'double',
285285
'store' => true
286286
]
287287
]
@@ -300,7 +300,7 @@ public function attributeProvider()
300300
'index' => 'no_index'
301301
],
302302
'price_1_1' => [
303-
'type' => 'float',
303+
'type' => 'double',
304304
'store' => true
305305
]
306306
],
@@ -319,7 +319,7 @@ public function attributeProvider()
319319
'index' => 'no_index'
320320
],
321321
'price_1_1' => [
322-
'type' => 'float',
322+
'type' => 'double',
323323
'store' => true
324324
]
325325
]

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/ConverterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function convertProvider()
5656
{
5757
return [
5858
['string', 'string'],
59-
['float', 'float'],
59+
['float', 'double'],
6060
['integer', 'integer'],
6161
];
6262
}

app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public function addFieldsMapping(array $fields, $index, $entityType)
281281
'match' => 'price_*',
282282
'match_mapping_type' => 'string',
283283
'mapping' => [
284-
'type' => 'float',
284+
'type' => 'double',
285285
'store' => true,
286286
],
287287
],

app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ public function testAddFieldsMapping()
439439
'match' => 'price_*',
440440
'match_mapping_type' => 'string',
441441
'mapping' => [
442-
'type' => 'float',
442+
'type' => 'double',
443443
'store' => true,
444444
],
445445
],
@@ -509,7 +509,7 @@ public function testAddFieldsMappingFailure()
509509
'match' => 'price_*',
510510
'match_mapping_type' => 'string',
511511
'mapping' => [
512-
'type' => 'float',
512+
'type' => 'double',
513513
'store' => true,
514514
],
515515
],

app/code/Magento/Elasticsearch7/Model/Client/Elasticsearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public function addFieldsMapping(array $fields, string $index, string $entityTyp
289289
'match' => 'price_*',
290290
'match_mapping_type' => 'string',
291291
'mapping' => [
292-
'type' => 'float',
292+
'type' => 'double',
293293
'store' => true,
294294
],
295295
],

0 commit comments

Comments
 (0)