Closed davidwindell closed 3 years ago
Hi,
You need to reindex data.
php bin/magento indexer:reindex
I had already re-indexed but the error persists unfortunately, have you tested on Magento 2.4.2?
We are running Elastic Suite 2.10.3.
Yes i test it with magento 2.4.2 and product sample data and Elastic Suite 2.10.3.
If request_path is empty you should look a this function
{
$connection = $this->resource->getConnection();
$select = $connection->select()->from(
['url_rewrite' => $connection->getTableName('url_rewrite')],
['request_path', 'entity_id']
)->where('entity_type = ?', 'product')
->where('entity_id IN (?)', $productId)
->where('store_id = ?', $storeId)
->where('redirect_type = 0')
->where('metadata IS NULL');
return $connection->fetchAll($select);
}
Is your url rewrite database build correctly ?
If you execute this query, you need to have 0 rows :
SELECT cpe.sku, ur.request_path FROM catalog_product_entity cpe INNER JOIN catalog_product_entity_int cpei ON (cpei.entity_id = cpe.entity_id AND value =4) INNER JOIN eav_attribute ea ON (ea.attribute_code = 'visibility' AND ea.attribute_id = cpei.attribute_id) LEFT JOIN url_rewrite ur ON (ur.entity_type = 'product' AND ur.entity_id = cpe.entity_id AND ur.store_id = 1 AND redirect_type = 0 AND ur.metadata IS NULL) WHERE request_path IS NULL
Thanks @kpitn, I'm seeing ~50 results with that query, what is this query showing? Products that don't have a valid rewrite rule?
For example with sample data, url_rewrites looks like :
SELECT cpe.sku, ur.request_path FROM catalog_product_entity cpe INNER JOIN catalog_product_entity_int cpei ON (cpei.entity_id = cpe.entity_id AND value =4) INNER JOIN eav_attribute ea ON (ea.attribute_code = 'visibility' AND ea.attribute_id = cpei.attribute_id) LEFT JOIN url_rewrite ur ON (ur.entity_type = 'product' AND ur.entity_id = cpe.entity_id AND ur.store_id = 1)
If your data comes from a M1 migration, sometimes you don't have metada = NULL, but metadata = []
Thanks, I ended up using https://github.com/olegkoval/magento2-regenerate_url_rewrites to regenerate the table which seems to have done the trick.
@kpitn just to say thanks again for this module, we're now live with it and it's working well!
Thank you for your return
Trying the module out with the latest version on Magento 2.4.2 and seeing these errors from search.php: