Open Nuranto opened 2 months ago
Hi @Nuranto
I think that, as a first step, we'll add something onto this line : https://github.com/Smile-SA/elasticsuite/blob/2.11.x/src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Adapter.php#L84
Most probably, we'll add to the HTTP context some variable, like "X-Search-Failure". This should allow you to set these pages as not-cacheable with a plugin on the HTTP context later on.
Would this fit ?
Regards
Hi @romainruaud ,
Thank you for your answer,
We already fixed the caching issue by throwing the exception when it happens. We prefer a temporary error on our category page than a long-term empty category. Your solution would work too, but I think a more "out of the box" solution would be better.
And it works, we just got alerted that the issue occured again. Here is the exception that causes the issue :
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "failed to create query: empty String",
"index_uuid": "---",
"index": "magento2_default_catalog_product_20240929_232103"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "magento2_default_catalog_product_20240929_232103",
"node": "---",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: empty String",
"index_uuid": "---",
"index": "magento2_default_catalog_product_20240929_232103",
"caused_by": {
"type": "number_format_exception",
"reason": "empty String"
}
}
}
]
},
"status": 400
}
After cleaning magento cache (bin/magento c:f
), the error disappeared.
I don't know where to search here, any ideas on how to debug ? How a query can be empty, and why purging cache solves that ?
Magento Version : 2.4.7-p2
ElasticSuite Version : 2.11.8.3
Steps to reproduce
src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Adapter.php
: add line$searchResponse = [];
beforereturn
Expected result
Actual result
Additional informations
The case where an exception is thrown and
$searchResponse
gets empty is very very rare in our case. But when it happens, it may be put in cache by Varnish, which causes empty categories displayed to customers for hours...Also the exception logging method (
$this->logger->error($e->getMessage());
) is not very handy. A specific logfile and usage of$this->logger->critical($e);
would be more powerfull for debugging.Note : jfyi there's a similar issue on Adobe's adapter : https://github.com/magento/magento2/issues/38284