Skip to content

Commit b9d331a

Browse files
author
Roger
committed
issue 31043: update code
1 parent d619c86 commit b9d331a

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

app/code/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapper.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
namespace Magento\Elasticsearch\Model\Adapter\BatchDataMapper;
88

9+
use Magento\AdvancedSearch\Model\Adapter\DataMapper\AdditionalFieldsProviderInterface;
910
use Magento\CatalogSearch\Model\Indexer\Fulltext\Action\DataProvider;
11+
use Magento\Eav\Api\Data\AttributeOptionInterface;
1012
use Magento\Eav\Model\Entity\Attribute;
13+
use Magento\Elasticsearch\Model\Adapter\BatchDataMapperInterface;
1114
use Magento\Elasticsearch\Model\Adapter\Document\Builder;
1215
use Magento\Elasticsearch\Model\Adapter\FieldMapperInterface;
13-
use Magento\Elasticsearch\Model\Adapter\BatchDataMapperInterface;
1416
use Magento\Elasticsearch\Model\Adapter\FieldType\Date as DateFieldType;
15-
use Magento\AdvancedSearch\Model\Adapter\DataMapper\AdditionalFieldsProviderInterface;
16-
use Magento\Eav\Api\Data\AttributeOptionInterface;
1717

1818
/**
1919
* Map product index data to search engine metadata
@@ -151,6 +151,7 @@ public function map(array $documentData, $storeId, array $context = [])
151151

152152
foreach ($documentData as $productId => $indexData) {
153153
$this->builder->addField('store_id', $storeId);
154+
$this->builder->addField('entity_id', $productId);
154155
$productIndexData = $this->convertToProductData($productId, $indexData, $storeId);
155156
foreach ($productIndexData as $attributeCode => $value) {
156157
// Prepare processing attribute info

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ public function getFields(array $context = []): array
119119
'index' => $this->indexTypeConverter->convert(IndexTypeConverterInterface::INTERNAL_NO_INDEX_VALUE),
120120
];
121121

122+
$allAttributes['entity_id'] = [
123+
'type' => $this->fieldTypeConverter->convert(FieldTypeConverterInterface::INTERNAL_DATA_TYPE_INT),
124+
'index' => $this->indexTypeConverter->convert(IndexTypeConverterInterface::INTERNAL_NO_INDEX_VALUE),
125+
];
122126
return $allAttributes;
123127
}
124128

app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder/Sort.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function getSort(RequestInterface $request)
124124

125125
if (!empty($sorts)) {
126126
$sorts[] = [
127-
'_id' => [
127+
'entity_id' => [
128128
'order' => 'desc'
129129
]
130130
];

app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/Query/Builder/SortTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function getSortProvider()
168168
]
169169
],
170170
[
171-
'_id' => [
171+
'entity_id' => [
172172
'order' => 'desc'
173173
]
174174
]
@@ -197,7 +197,7 @@ public function getSortProvider()
197197
]
198198
],
199199
[
200-
'_id' => [
200+
'entity_id' => [
201201
'order' => 'desc'
202202
]
203203
]
@@ -226,7 +226,7 @@ public function getSortProvider()
226226
]
227227
],
228228
[
229-
'_id' => [
229+
'entity_id' => [
230230
'order' => 'desc'
231231
]
232232
]
@@ -255,7 +255,7 @@ public function getSortProvider()
255255
]
256256
],
257257
[
258-
'_id' => [
258+
'entity_id' => [
259259
'order' => 'desc'
260260
]
261261
]
@@ -284,7 +284,7 @@ public function getSortProvider()
284284
]
285285
],
286286
[
287-
'_id' => [
287+
'entity_id' => [
288288
'order' => 'desc'
289289
]
290290
]

0 commit comments

Comments
 (0)