Skip to content

Commit e237ec4

Browse files
committed
ACP2E-2279: A-Z Product sorting for Turkish characters
1 parent 78cf0ec commit e237ec4

File tree

2 files changed

+27
-0
lines changed
  • app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider
  • dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer

2 files changed

+27
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ public function attributeProvider(): array
297297
'sort_attr_code' => [
298298
'type' => 'string',
299299
'index' => 'not_analyzed',
300+
'normalizer' => 'folding',
300301
],
301302
],
302303
],
@@ -375,6 +376,7 @@ public function attributeProvider(): array
375376
'sort_attr_code' => [
376377
'type' => 'string',
377378
'index' => 'not_analyzed',
379+
'normalizer' => 'folding',
378380
],
379381
],
380382
],

dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/ReindexAllTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
namespace Magento\Elasticsearch\Model\Indexer;
77

88
use Magento\Catalog\Api\ProductRepositoryInterface;
9+
use Magento\Catalog\Test\Fixture\Product as ProductFixture;
910
use Magento\Indexer\Model\Indexer;
11+
use Magento\TestFramework\Fixture\DataFixture;
1012
use Magento\TestFramework\Helper\Bootstrap;
1113
use Magento\Store\Model\StoreManagerInterface;
1214
use Magento\Elasticsearch\SearchAdapter\ConnectionManager;
@@ -166,6 +168,29 @@ public function testSortCaseSensitive(): void
166168
self::assertEquals($productThird->getId(), $fifthInSearchResults);
167169
}
168170

171+
#[
172+
DataFixture(ProductFixture::class, ['sku' => 'p1', 'name' => 'A']),
173+
DataFixture(ProductFixture::class, ['sku' => 'p2', 'name' => 'Ç']),
174+
DataFixture(ProductFixture::class, ['sku' => 'p3', 'name' => 'D']),
175+
DataFixture(ProductFixture::class, ['sku' => 'p4', 'name' => 'Ü']),
176+
DataFixture(ProductFixture::class, ['sku' => 'p5', 'name' => 'Z']),
177+
]
178+
public function testSortAccentedCharacters(): void
179+
{
180+
$expectedOrder = [
181+
(int) $this->productRepository->get('p1')->getId(),
182+
(int) $this->productRepository->get('p2')->getId(),
183+
(int) $this->productRepository->get('p3')->getId(),
184+
(int) $this->productRepository->get('p4')->getId(),
185+
(int) $this->productRepository->get('p5')->getId(),
186+
];
187+
$this->reindexAll();
188+
189+
$result = $this->sortByName();
190+
$actualOrder = array_map(fn ($id) => (int) $id, array_column($result, '_id'));
191+
self::assertEquals($expectedOrder, $actualOrder);
192+
}
193+
169194
/**
170195
* Test search of specific product after full reindex
171196
*

0 commit comments

Comments
 (0)