Skip to content

Commit f690735

Browse files
committed
MAGE-1138: add useTmpIndex logic to the product index builder
1 parent e9242bc commit f690735

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Helper/Configuration/QueueHelper.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class QueueHelper
1111
public const USE_BUILT_IN_CRON = 'algoliasearch_queue/queue/use_built_in_cron';
1212
public const NUMBER_OF_JOB_TO_RUN = 'algoliasearch_queue/queue/number_of_job_to_run';
1313
public const RETRY_LIMIT = 'algoliasearch_queue/queue/number_of_retries';
14+
public const USE_TMP_INDEX = 'algoliasearch_queue/queue/use_tmp_index';
1415

1516
public function __construct(
1617
protected ScopeConfigInterface $configInterface,
@@ -53,4 +54,14 @@ public function getRetryLimit($storeId = null)
5354
{
5455
return (int)$this->configInterface->getValue(self::RETRY_LIMIT, ScopeInterface::SCOPE_STORE, $storeId);
5556
}
57+
58+
/**
59+
* @param $storeId
60+
* @return bool
61+
*/
62+
public function useTmpIndex($storeId = null)
63+
{
64+
return $this->isQueueActive($storeId) &&
65+
$this->configInterface->isSetFlag(self::USE_TMP_INDEX, ScopeInterface::SCOPE_STORE, $storeId);
66+
}
5667
}

Service/Product/BatchQueueProcessor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Algolia\AlgoliaSearch\Exception\DiagnosticsException;
77
use Algolia\AlgoliaSearch\Exceptions\AlgoliaException;
88
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
9+
use Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper;
910
use Algolia\AlgoliaSearch\Helper\Data;
1011
use Algolia\AlgoliaSearch\Helper\Entity\ProductHelper;
1112
use Algolia\AlgoliaSearch\Logger\DiagnosticsLogger;
@@ -24,6 +25,7 @@ public function __construct(
2425
protected Data $dataHelper,
2526
protected ConfigHelper $configHelper,
2627
protected ProductHelper $productHelper,
28+
protected QueueHelper $queueHelper,
2729
protected Queue $queue,
2830
protected DiagnosticsLogger $diag,
2931
protected AlgoliaCredentialsManager $algoliaCredentialsManager,
@@ -56,7 +58,7 @@ public function processBatch(int $storeId, ?array $entityIds = null): void
5658
return;
5759
}
5860

59-
$useTmpIndex = $this->configHelper->isQueueActive($storeId);
61+
$useTmpIndex = $this->queueHelper->useTmpIndex($storeId);
6062
$this->syncAlgoliaSettings($storeId, $useTmpIndex);
6163

6264
$this->handleFullIndex($storeId, $productsPerPage, $useTmpIndex);

Ui/Component/Listing/Column/Data.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ protected function formatData(array $data, $depth = 0): string
5353

5454
continue;
5555
}
56-
56+
if (is_bool($value)) {
57+
$value = $value ? 'Yes' : 'No';
58+
}
5759
$formattedData .= str_repeat('&nbsp;&nbsp;&nbsp;', $depth ) . $stringKey . ' : ' . $value . '<br>';
5860
}
5961

0 commit comments

Comments
 (0)