Magento 中重新索引错误可能有很多原因,所以恐怕永远不会有一个“理想”的解决方案涵盖所有可能的错误。
由于您发布了非技术错误消息,我猜您已尝试使用管理后端重新索引产品平面数据并在那里看到错误消息。
我建议尝试再次重新索引,但使用shell/indexer.php
这次:
/usr/bin/php -f /abs/path/to/shell/indexer.php -- --reindex catalog_product_flat
这样,如果重新索引失败,您将获得更有意义的技术错误消息。
下面的列表显示了哪个参数用于哪个索引:
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
cataloginventory_stock Stock Status
tag_summary Tag Aggregation Data
UPDATE
您在帖子中添加的例外情况表明,之间的引用完整性
catalog_product_flat_4.entity_id
and
catalog_product_entity.entity_id
发现已损坏。
通常这意味着某些记录包含null
在该领域catalog_product_entity.entity_id
,其中预计将包含现有的entity_id
s.
在尝试解决此问题之前,请首先备份你的数据库.
现在,要查找损坏的记录,请使用以下命令查询数据库:
SELECT
a.entity_id
FROM
catalog_product_flat_4 AS a
LEFT JOIN
catalog_product_entity AS b ON a.entity_id = b.entity_id
WHERE
ISNULL(b.entity_id)
The entity_id
此查询找到的s是entity_id
表中的catalog_product_flat_4
,这些已损坏,需要删除。
删除相应的记录catalog_product_flat_4
,然后再次尝试重新索引。