简体   繁体   English

Magento 2.1重新索引问题

[英]Magento 2.1 re-indexing issue

I am using Magento 2.1 我正在使用Magento 2.1

I have an issue that after i re-index products get hidden. 我有一个问题,在我重新索引产品后将其隐藏。 I do have a work around but this is not good. 我确实有解决方法,但这不好。 Let me explain how I reproduce error then what i do to fix. 让我解释一下如何重现错误,然后解决问题。

  1. Upload via emagic 7000 products 通过emagic 7000产品上传
  2. I notice as the products are been loaded that the front end is looking good 我注意到,由于已加载产品,因此前端看起来不错
  3. After upload products automatically indexed (or i run index command) 上传产品后自动建立索引(或我运行index命令)
  4. Products are hidden from front end ( ie 1 page should have 1,500 products but now only shows 500 another page should have 6,000 products but now only shows 500 and a page showing all records with 7,500 now only shows 500) 产品是从前端隐藏的(例如,一页应该有1,500种产品,但是现在只显示500;另一页应该有6,000种产品,但是现在仅显示500;而显示所有记录的页面有7,500,现在只显示500)

I can fix this by doing the following 1. run this sql query to disable all products UPDATE catalog_product_entity_int SET value =0 WHERE attribute_id =94 我可以通过以下步骤解决此问题:1.运行此sql查询以禁用所有产品UPDATE catalog_product_entity_int SET值= 0 WHERE attribute_id = 94

  1. run re-index command php bin/magento indexer:reindex 运行重新索引命令php bin / magento indexer:reindex

  2. run sql query to enable all products UPDATE catalog_product_entity_int SET value =1 WHERE attribute_id =94 运行sql查询以启用所有产品UPDATE catalog_product_entity_int SET值= 1 WHERE attribute_id = 94

  3. run re-index command php bin/magento indexer:reindex 运行重新索引命令php bin / magento indexer:reindex

  4. run this command (twice) php bin/magento cron:run php bin/magento cron:run 运行此命令(两次)php bin / magento cron:run php bin / magento cron:run

then all products display again. 然后所有产品再次显示。 but if i run re-index again I have to repeat steps i to 5 to get working again which is not very good. 但是,如果我再次运行重新索引,则必须重复步骤5至5才能重新工作,这不是很好。

I also notice that the below 2 commands cause the issue, all other index commands run seperatly cause no problems php bin/magento indexer:reindex catalog_category_product php bin/magento indexer:reindex catalog_product_category 我还注意到以下2个命令导致了此问题,所有其他索引命令单独运行不会导致任何问题php bin / magento indexer:reindex catalog_category_product php bin / magento indexer:reindex catalog_product_category

How can I fix this permanently? 如何永久解决此问题? any ideas 有任何想法吗

I resolved this issue after completely clearing all products (truncating MYSQL) I did the following two steps 在完全清除所有产品(截断MYSQL)后,我解决了此问题,我做了以下两个步骤

  1. Followed the details in the below link to truncate all tables that to delete all data ready for re-import. 按照下面链接中的详细信息截断所有表,以删除准备重新导入的所有数据。 Obviously get a back up of your data to re-import first 显然,要先备份数据以重新导入

  2. Checked mysql and truncated all tables in mysql beginning with 'catalog_' EXCEPT catalog_product_link_type 检查mysql并截断mysql中所有以'catalog_'开头的表(不包括catalog_product_link_type)

3.logeed in as ssh and ran the following commands cd public_html php -f bin/magento indexer:reindex 3.以ssh身份登录并运行以下命令cd public_html php -f bin / magento indexer:reindex

Delete the static view files directory and compile directory 删除静态视图文件目录并编译目录

rm -rf var/di mkdir var/di rm -rf var/generation mkdir var/generation cd pub/static rm -rf _cache rm -rf deployed_version.txt rm -rf frontend rm -rf _requirejs rm -rf adminhtml cd .. cd .. php -f bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php -f bin/magento cache:clean php -f bin/magento cache:flush php -f bin/magento indexer:reindex rm -rf var / di mkdir var / di rm -rf var / generation mkdir var / generation cd pub / static rm -rf _cache rm -rf deployed_version.txt rm -rf前端rm -rf _requirejs rm -rf adminhtml cd .. cd .. php -f bin / magento设置:升级php bin / magento设置:di:编译php bin / magento设置:静态内容:部署php -f bin / magento缓存:clean php -f bin / magento缓存:flush php -f bin / magento索引器:重新索引

  1. Then I removed all product related images (again back up for re-import) rm -rf /pub/media/catalog/product mkdir /pub/media/catalog/product 然后,我删除了所有与产品相关的图像(再次备份以重新导入)rm -rf / pub / media / catalog / product mkdir / pub / media / catalog / product

That worked for me, just started cleared the database and all files ready for re-import 这对我有用,刚刚开始清除数据库,所有文件都准备好重新导入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM