Skip to content

Commit affa603

Browse files
committed
MAGE-1151: update queue invoke
1 parent 579cf79 commit affa603

File tree

10 files changed

+51
-33
lines changed

10 files changed

+51
-33
lines changed

Model/Indexer/AdditionalSection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public function executeFull()
4040
return;
4141
}
4242

43-
/** @uses AdditionalSectionIndexBuilder::buildIndex() */
43+
/** @uses AdditionalSectionIndexBuilder::buildIndexFull() */
4444
$this->queue->addToQueue(
4545
AdditionalSectionIndexBuilder::class,
46-
'buildIndex',
46+
'buildIndexFull',
4747
['storeId' => $storeId],
4848
1
4949
);

Model/Indexer/Category.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ private function rebuildAffectedProducts($storeId)
8181
if ($affectedProductsCount > 0 && $this->configHelper->indexProductOnCategoryProductsUpdate($storeId)) {
8282
$productsPerPage = $this->configHelper->getNumberOfElementByPage();
8383
foreach (array_chunk($affectedProducts, $productsPerPage) as $chunk) {
84-
/** @uses ProductIndexBuilder::rebuildEntityIds() */
84+
/** @uses ProductIndexBuilder::buildIndexList() */
8585
$this->queue->addToQueue(
8686
ProductIndexBuilder::class,
87-
'rebuildEntityIds',
87+
'buildIndexList',
8888
[
8989
'storeId' => $storeId,
90-
'productIds' => $chunk,
90+
'ids' => $chunk,
9191
],
9292
count($chunk)
9393
);
@@ -103,13 +103,13 @@ private function rebuildAffectedProducts($storeId)
103103
private function processSpecificCategories($categoryIds, $categoriesPerPage, $storeId)
104104
{
105105
foreach (array_chunk($categoryIds, $categoriesPerPage) as $chunk) {
106-
/** @uses CategoryIndexBuilder::rebuildEntityIds */
106+
/** @uses CategoryIndexBuilder::buildIndexList */
107107
$this->queue->addToQueue(
108108
CategoryIndexBuilder::class,
109-
'rebuildEntityIds',
109+
'buildIndexList',
110110
[
111111
'storeId' => $storeId,
112-
'categoryIds' => $chunk,
112+
'ids' => $chunk,
113113
],
114114
count($chunk)
115115
);
@@ -136,12 +136,20 @@ private function processFullReindex($storeId, $categoriesPerPage)
136136
for ($i = 1; $i <= $pages; $i++) {
137137
$data = [
138138
'storeId' => $storeId,
139-
'page' => $i,
140-
'pageSize' => $categoriesPerPage,
139+
'options' => [
140+
'page' => $i,
141+
'pageSize' => $categoriesPerPage,
142+
]
141143
];
142144

143-
/** @uses CategoryIndexBuilder::buildIndex() */
144-
$this->queue->addToQueue(CategoryIndexBuilder::class, 'buildIndex', $data, $categoriesPerPage, true);
145+
/** @uses CategoryIndexBuilder::buildIndexFull() */
146+
$this->queue->addToQueue(
147+
CategoryIndexBuilder::class,
148+
'buildIndexFull',
149+
$data,
150+
$categoriesPerPage,
151+
true
152+
);
145153
}
146154
}
147155
}

Model/Indexer/Page.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ public function execute($ids)
4646
if ($this->isPagesInAdditionalSections($storeId)) {
4747
$data = ['storeId' => $storeId];
4848
if (is_array($ids) && count($ids) > 0) {
49-
$data['pageIds'] = $ids;
49+
$data['options'] = ['ids' => $ids];
5050
}
5151

52-
/** @uses PageIndexBuilder::buildIndex() */
52+
/** @uses PageIndexBuilder::buildIndexFull() */
5353
$this->queue->addToQueue(
5454
PageIndexBuilder::class,
55-
'buildIndex',
55+
'buildIndexFull',
5656
$data,
5757
is_array($ids) ? count($ids) : 1
5858
);

Model/Indexer/Product.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ public function execute($productIds)
5858

5959
if (is_array($productIds) && count($productIds) > 0) {
6060
foreach (array_chunk($productIds, $productsPerPage) as $chunk) {
61-
/** @uses ProductIndexBuilder::rebuildEntityIds() */
61+
/** @uses ProductIndexBuilder::buildIndexList() */
6262
$this->queue->addToQueue(
6363
ProductIndexBuilder::class,
64-
'rebuildEntityIds',
65-
['storeId' => $storeId, 'productIds' => $chunk],
64+
'buildIndexList',
65+
['storeId' => $storeId, 'ids' => $chunk],
6666
count($chunk)
6767
);
6868
}
@@ -89,16 +89,18 @@ public function execute($productIds)
8989
for ($i = 1; $i <= $pages; $i++) {
9090
$data = [
9191
'storeId' => $storeId,
92-
'productIds' => $productIds,
93-
'page' => $i,
94-
'pageSize' => $productsPerPage,
95-
'useTmpIndex' => $useTmpIndex,
92+
'options' => [
93+
'productIds' => $productIds,
94+
'page' => $i,
95+
'pageSize' => $productsPerPage,
96+
'useTmpIndex' => $useTmpIndex,
97+
]
9698
];
9799

98-
/** @uses ProductIndexBuilder::buildIndex() */
100+
/** @uses ProductIndexBuilder::buildIndexFull() */
99101
$this->queue->addToQueue(
100102
ProductIndexBuilder::class,
101-
'buildIndex',
103+
'buildIndexFull',
102104
$data,
103105
$productsPerPage,
104106
true

Model/Indexer/Suggestion.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public function executeFull()
4343
return;
4444
}
4545

46-
/** @uses SuggestionIndexBuilder::buildIndex() */
46+
/** @uses SuggestionIndexBuilder::buildIndexFull() */
4747
$this->queue->addToQueue(
4848
SuggestionIndexBuilder::class,
49-
'buildIndex',
49+
'buildIndexFull',
5050
['storeId' => $storeId],
5151
1
5252
);

Model/Source/JobMethods.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class JobMethods implements \Magento\Framework\Data\OptionSourceInterface
77
private $methods = [
88
'saveConfigurationToAlgolia' => 'Save Configuration',
99
'moveIndexWithSetSettings' => 'Move Index',
10-
'buildIndex' => 'Build Full Index',
11-
'rebuildEntityIds' => 'Update Index',
10+
'buildIndexFull' => 'Build Full Index',
11+
'buildIndexList' => 'Update Index',
1212
'deleteInactiveProducts' => 'Delete Inactive Products',
1313
// @deprecated
1414
'deleteObjects' => 'Object deletion (deprecated)',

Service/Category/IndexBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function buildIndex(int $storeId, ?array $ids, ?array $options): void
9191
* @throws NoSuchEntityException
9292
* @throws \Exception
9393
*/
94-
public function rebuildEntityIds($storeId, $categoryIds = null): void
94+
protected function rebuildEntityIds($storeId, $categoryIds = null): void
9595
{
9696
if ($this->isIndexingEnabled($storeId) === false) {
9797
return;

Service/Product/IndexBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function buildIndex(int $storeId, ?array $ids, ?array $options): void
104104
* @return void
105105
* @throws \Exception
106106
*/
107-
public function rebuildEntityIds(int $storeId, array $productIds): void
107+
protected function rebuildEntityIds(int $storeId, array $productIds): void
108108
{
109109
if ($this->isIndexingEnabled($storeId) === false) {
110110
return;

Test/Integration/Queue/QueueTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testFill()
7474

7575
if ($i < 3) {
7676
$this->assertEquals(\Algolia\AlgoliaSearch\Service\Product\IndexBuilder::class, $row['class']);
77-
$this->assertEquals('buildIndex', $row['method']);
77+
$this->assertEquals('buildIndexFull', $row['method']);
7878
$this->assertEquals(300, $row['data_size']);
7979

8080
continue;

Ui/Component/Listing/Column/Data.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,17 @@ public function prepareDataSource(array $dataSource)
2727
if (is_array($data)) {
2828
foreach ($data as $key => $value) {
2929
if (is_array($value)) {
30-
$value = implode(', ', $value);
30+
$stringValue = '';
31+
foreach ($value as $k => $v) {
32+
if (is_string($k)) {
33+
$stringValue .= '<br>&nbsp;&nbsp;&nbsp; - <strong>' . $k . '</strong> : '. $v;
34+
} else {
35+
$stringValue .= $v . ',';
36+
}
37+
}
38+
$value = rtrim($stringValue,",");
3139
}
32-
$formattedData .= $key . ' : ' . $value . '<br>';
40+
$formattedData .= '- <strong>' .$key . '</strong> : ' . $value . '<br>';
3341
}
3442
}
3543
$item[$fieldName] = $formattedData;

0 commit comments

Comments
 (0)