当数据量较大时 后台索引的速度往往过慢导致异常

当然使用shell更新索引,操作起来也更简单快捷,用不着看着浏览器慢慢加载,从登录后台到等待索引完成

废话不多说了,需要用到的可以参考下下:

首先进入/path/to/magento/shell

#php -f indexer.php 可以看到如下的帮助信息

Usage: php -f indexer.php -- [options]

--status <indexer> Show Indexer(s) Status 查看索引状态
--mode <indexer> Show Indexer(s) Index Mode 查看索引模式
--mode-realtime <indexer> Set index mode type "Update on Save" 更新索引模式
--mode-manual <indexer> Set index mode type "Manual Update" 更新索引模式
--reindex <indexer> Reindex Data 重新索引
info Show allowed indexers 列出可索引项
reindexall Reindex Data by all indexers 重新索引所有项
help This help 显示此帮助

<indexer> Comma separated indexer codes or value "all" for all indexers 逗号隔开或all表示所有

eg1:列出所有可索引的项

$ php indexer.php info
catalog_product_attribute Product Attributes
catalog_product_price Product Prices
catalog_url Catalog URL Rewrites
catalog_product_flat Product Flat Data
catalog_category_flat Category Flat Data
catalog_category_product Category Products
catalogsearch_fulltext Catalog Search Index
tag_summary Tag Aggregation Data
cataloginventory_stock Stock Status

eg2: 显示某项索引的模式

$ php indexer.php --mode catalog_url
Catalog URL Rewrites: Update on Save


eg3:重新建立某项索引

$ php indexer.php --reindex catalog_product_price
Product Prices index was rebuilt successfully

eg4: 重建所有索引

# php indexer.php reindexall