Skip to content

Commit cebae8c

Browse files
committed
6775 Fixes and improvements about slicing functionality
1 parent 0777d99 commit cebae8c

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/app/code/community/IntegerNet/Solr/Model/Bridge/ProductRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ function($parentId, $childrenIds) {
7272
*/
7373
public function getAllProductIds($sliceId = null, $totalNumberSlices = null)
7474
{
75+
/** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
7576
$productCollection = Mage::getResourceModel('catalog/product_collection');
7677

77-
/** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
7878
if ((!is_null($sliceId)) && (!is_null($totalNumberSlices))) {
7979
if ($sliceId == $totalNumberSlices) {
8080
$sliceId = 0;

src/shell/integernet-solr.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ public function run()
5555

5656
$indexer = Mage::helper('integernet_solr')->factory()->getProductIndexer();
5757

58-
if ($this->getArg('use-swap-core')) {
58+
if ($this->getArg('use_swap_core')) {
5959
$indexer->activateSwapCore();
6060
}
6161
$indexer->reindex(null, $emptyIndex, $storeIds, $sliceId, $totalNumberSlices);
62-
if ($this->getArg('use-swap-core')) {
62+
if ($this->getArg('use_swap_core')) {
6363
$indexer->deactivateSwapCore();
6464
}
6565

@@ -94,9 +94,15 @@ public function run()
9494
}
9595
$storeIds = $this->_getStoreIds($storeIdentifiers);
9696
$indexer = Mage::helper('integernet_solr')->factory()->getProductIndexer();
97+
if ($this->getArg('use_swap_core')) {
98+
$indexer->activateSwapCore();
99+
}
97100
foreach($storeIds as $storeId) {
98101
$indexer->clearIndex($storeId);
99102
}
103+
if ($this->getArg('use_swap_core')) {
104+
$indexer->deactivateSwapCore();
105+
}
100106
$storeIdsString = implode(', ', $storeIds);
101107
echo "Solr product index cleared for Stores {$storeIdsString}.\n";
102108

@@ -131,7 +137,7 @@ public function usageHelp()
131137
Usage: php -f integernet-solr.php -- [options]
132138
php -f integernet-solr.php -- reindex --stores de
133139
php -f integernet-solr.php -- reindex --stores all --emptyindex
134-
php -f integernet-solr.php -- reindex --stores 1 --slice 1/5 --use-swap-core
140+
php -f integernet-solr.php -- reindex --stores 1 --slice 1/5 --use_swap_core
135141
php -f integernet-solr.php -- clear --stores 1
136142
137143
reindex Reindex solr for given stores (see "stores" param)
@@ -140,11 +146,11 @@ public function usageHelp()
140146
--noemptyindex Force not emptying the solr index for the given store(s). If not set, configured value is used.
141147
--types <types> Restrict indexing to certain entity types, i.e. "product", "category" or "page" (comma separated). Or "all". If not set, reindex products.
142148
--slice <number>/<total_number>, i.e. "1/5" or "2/5". Use this if you want to index only a part of the products, i.e. for letting indexing run in parallel (for products only).
143-
--use-swap-core Use swap core for indexing instead of live core (only if configured correctly). This is useful when using slices (see above), it's not needed otherwise.
149+
--use_swap_core Use swap core for indexing instead of live solr core (only if configured correctly) (for products only). This is useful if using slices (see above), it's not needed otherwise.
144150
145-
clear Clear solr product index for given stores (see "stores" param)
151+
clear Clear solr product index for given stores (see "stores" param and "use_swap_core" param)
146152
147-
swap-cores Swap cores. This is useful when using slices (see above) after indexing with the "--use-swap-core" param, it's not needed otherwise. See "stores" param.
153+
swap-cores Swap cores. This is useful if using slices (see above) after indexing with the "--use_swap_core" param; it's not needed otherwise. See "stores" param.
148154
149155
help This help
150156

0 commit comments

Comments
 (0)