作者 ajing-tuzi 日期 2015年12月07日 版本0.2
第一步
1.登陆你的magento 服务器 或这切换到对服务有写入权限的帐户 Windows 下就直接切换到目录
2 如果你想在任何目录运行你的 Magento 命令行的话 你可以将/bin 添加到你系统的 PATH
CentOS 的Bash shell 的示例:
export PATH=$PATH:/home/wwwroot/weicot_public/Mage2/bin
备注:
你也可以运用以下方法
Cd /bin目录下 运行 ./magento
Php /bin/magento
查看索引列表
开始进入使用命令行索引的主题讨论
magento indexer:info
这个列表显示如下
jiang@小江 e:\XPP\htdocs\Mage2\bin
# php magento indexer:info
customer_grid Customer Grid
catalog_category_product Category Products
catalog_product_category Product Categories
catalog_product_price Product Price
catalog_product_attribute Product EAV
cataloginventory_stock Stock
catalogsearch_fulltext Catalog Search
catalogrule_rule Catalog Rule Product
catalogrule_product Catalog Product Rule
查看索引状态
这个命令可以查看你所有或选定的索引的状态
例子:显示是否索引需要重新索引的条目
命令选项
magento indexer:status [indexer]
其中 [indexer]-列表 是用空格隔开的 如省略[indexer]则是 查看所有索引的状态
要查看索引列表 键入
magento indexer:info
jiang@小江 e:\XPP\htdocs\Mage2\bin
# php magento indexer:info
customer_grid Customer Grid
catalog_category_product Category Products
catalog_product_category Product Categories
catalog_product_price Product Price
catalog_product_attribute Product EAV
cataloginventory_stock Stock
catalogsearch_fulltext Catalog Search
catalogrule_rule Catalog Rule Product
catalogrule_product Catalog Product Rule
一个示例如下
magento indexer:status
示例返回结果
jiang@小江 e:\XPP\htdocs\Mage2\bin
# php magento indexer:status
Customer Grid: Ready
Category Products: Ready
Product Categories: Ready
Product Price: Ready
Product EAV: Ready
Stock: Ready
Catalog Search: Ready
Catalog Rule Product: Ready
Catalog Product Rule: Ready
在下个部分中我们将讨论重建索引
重建 索引
这个命令使你能够重建所有或你选择的索引 并将其索引一次
这个命令只会索引一次,要报持索引是最新的话 你必须设置你的计划任务[cron job]
命令选项
magento indexer:reindex [indexer]
其中 [indexer]-索引列表 是用空格隔开的 如省略[indexer]则是 查看所有索引的状态
要查看索引列表 键入
magento indexer:info
一个示例如下
magento indexer:reindex
示例返回
jiang@小江 e:\XPP\htdocs\Mage2\bin
# php magento indexer:reindex
Customer Grid index has been rebuilt successfully in 00:00:07
Category Products index has been rebuilt successfully in 00:00:02
Product Categories index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:00:08
Product EAV index has been rebuilt successfully in 00:00:02
Stock index has been rebuilt successfully in 00:00:01
Catalog Search index has been rebuilt successfully in 00:00:08
Catalog Rule Product index has been rebuilt successfully in 00:00:09
Catalog Product Rule index has been rebuilt successfully in 00:00:03
刷新 所有索引可能耗费很长时间 这些时间来自你店铺的
大量产品 和 客户资料 以及 促销规则
备注及引用
1.环境
windows 10 xampp
2.官方资料
http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-index.html#config-cli-subcommands-index-status