Magento mass_action 索引 - 它们是如何工作的?
Magento mass_action indexes - how do they work?
我已经创建了一些代码来更新 Magento 中的价格。我发现更新产品对象本身有点慢 - 所以我发现它可以一次更新单个属性,而且速度要快得多。
Mage::getSingleton('catalog/product_action')->updateAttributes(array($prod->getId()), array('price',10), $storeId);
当我 运行 这个时,在 index_event table -
中创建一个条目
类型: mass_action,
实体:catalog_product
new_data:
a:12:{s:35:"cataloginventory_stock_match_result";b:1;s:41:"Mage_CatalogInventory_Model_Indexer_Stock";a:1:{s:35:"cataloginventory_stock_match_result";b:1;}s:34:"catalog_product_price_match_result";b:1;s:40:"Mage_Catalog_Model_Product_Indexer_Price";a:2:{s:34:" =41=]_price_match_result";b:1;s:25:"reindex_price_product_ids";a:11:{i:0;s:2:"39";i:1;s:3:"363 ";i:2;s:3:"367";i:3;s:3:"371";i:4;s:3:"375";i:5;s:3:"379"; i:6;s:3:"383";i:7;s:3:"387";i:8;s:3:"391";i:9;s:3:"395";i: 10;s:3:"399";}}s:24:"catalog_url_match_result";b:0;s:33:"catalog_product_flat_match_result";b:1;s:39:" Mage_Catalog_Model_Product_Indexer_Flat";a:3:{s:33:"catalog_product_flat_match_result";b:1;s:33:"catalog_product_flat_force_update";b:1;s:32: "catalog_product_flat_product_ids";a:11:{i:0;s:2:"39";i:1;s:3:"363";i:2;s:3:"367"; i:3;s:3:"371";i:4;s:3:"375";i:5;s:3:"379";i:6;s:3:"383";i: 7;s:3:"387";i:8;s:3:"391";i:9;s:3:"395";i:10;s:3:"399";}}s: 34:"catalog_category_flat_match_result";b:0;s:37:"catalog_category_product_match_result";b:1;s:43:"Mage_Catalog_Model_Category_Indexer_Product";a:1:{s:37 :"catalog_category_product_match_result";b:1;}s:35:"catalogsearch_fulltext_match_result";b:1;s:41:"Mage_CatalogSearch_Model_Indexer_Fulltext";a:3:{s:35 :"catalogsearch_fulltext_match_result";b:1;s:27:"catalogsearch_force_reindex";b:1;s:25:"catalogsearch_product_ids";a:11:{i:0; s:2:"39";i:1;s:3:"363";i:2;s:3:"367";i:3;s:3:"371";i:4;s: 3:"375";i:5;s:3:"379";i:6;s:3:"383";i:7;s:3:"387";i:8;s:3: "391";i:9;s:3:"395";i:10;s:3:"399";}}}
我发现当我 运行 循环中的代码时,这条记录会自动添加到。
该数据是否仅用于重新索引受影响的产品?
如果启用 'manual indexing' 会怎样?
这对我来说是新的,所以希望有人能给出一些答案。
Magento 能够在每次产品更新操作时触发索引事件。在您的情况下,您正在尝试通过批量操作更新产品。因此,magento 触发了完整的重新索引。
如果产品数量较少,您可以使用 Magento 模型而不是操作。
否则,通过将标志 is_visible 更改为 false 来停止索引进程;在以下路径 Mage/Catalog/Model/Product/Indexer/Price.php 下。这将限制自动索引过程。
脚本完成后。你可以做手动价格指数。
我已经创建了一些代码来更新 Magento 中的价格。我发现更新产品对象本身有点慢 - 所以我发现它可以一次更新单个属性,而且速度要快得多。
Mage::getSingleton('catalog/product_action')->updateAttributes(array($prod->getId()), array('price',10), $storeId);
当我 运行 这个时,在 index_event table -
中创建一个条目类型: mass_action,
实体:catalog_product
new_data:
a:12:{s:35:"cataloginventory_stock_match_result";b:1;s:41:"Mage_CatalogInventory_Model_Indexer_Stock";a:1:{s:35:"cataloginventory_stock_match_result";b:1;}s:34:"catalog_product_price_match_result";b:1;s:40:"Mage_Catalog_Model_Product_Indexer_Price";a:2:{s:34:" =41=]_price_match_result";b:1;s:25:"reindex_price_product_ids";a:11:{i:0;s:2:"39";i:1;s:3:"363 ";i:2;s:3:"367";i:3;s:3:"371";i:4;s:3:"375";i:5;s:3:"379"; i:6;s:3:"383";i:7;s:3:"387";i:8;s:3:"391";i:9;s:3:"395";i: 10;s:3:"399";}}s:24:"catalog_url_match_result";b:0;s:33:"catalog_product_flat_match_result";b:1;s:39:" Mage_Catalog_Model_Product_Indexer_Flat";a:3:{s:33:"catalog_product_flat_match_result";b:1;s:33:"catalog_product_flat_force_update";b:1;s:32: "catalog_product_flat_product_ids";a:11:{i:0;s:2:"39";i:1;s:3:"363";i:2;s:3:"367"; i:3;s:3:"371";i:4;s:3:"375";i:5;s:3:"379";i:6;s:3:"383";i: 7;s:3:"387";i:8;s:3:"391";i:9;s:3:"395";i:10;s:3:"399";}}s: 34:"catalog_category_flat_match_result";b:0;s:37:"catalog_category_product_match_result";b:1;s:43:"Mage_Catalog_Model_Category_Indexer_Product";a:1:{s:37 :"catalog_category_product_match_result";b:1;}s:35:"catalogsearch_fulltext_match_result";b:1;s:41:"Mage_CatalogSearch_Model_Indexer_Fulltext";a:3:{s:35 :"catalogsearch_fulltext_match_result";b:1;s:27:"catalogsearch_force_reindex";b:1;s:25:"catalogsearch_product_ids";a:11:{i:0; s:2:"39";i:1;s:3:"363";i:2;s:3:"367";i:3;s:3:"371";i:4;s: 3:"375";i:5;s:3:"379";i:6;s:3:"383";i:7;s:3:"387";i:8;s:3: "391";i:9;s:3:"395";i:10;s:3:"399";}}}
我发现当我 运行 循环中的代码时,这条记录会自动添加到。
该数据是否仅用于重新索引受影响的产品?
如果启用 'manual indexing' 会怎样?
这对我来说是新的,所以希望有人能给出一些答案。
Magento 能够在每次产品更新操作时触发索引事件。在您的情况下,您正在尝试通过批量操作更新产品。因此,magento 触发了完整的重新索引。
如果产品数量较少,您可以使用 Magento 模型而不是操作。
否则,通过将标志 is_visible 更改为 false 来停止索引进程;在以下路径 Mage/Catalog/Model/Product/Indexer/Price.php 下。这将限制自动索引过程。
脚本完成后。你可以做手动价格指数。