ElasticSearch - Unable to find product "<Product URL>"
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
ElasticSearch - Unable to find product "<Product URL>"
Laravel framework version: 10.13.5
Aimeos Laravel version: ~2023.04
PHP Version: 8.2.7
Environment: Linux
Locale: Bulgarian
Hello,
I'm having problems getting to the product details page.
I have traced the error to this method:
Aimeos\Controller\Frontend\Product::resolve()
Something doesn't seem right with this filter index.text:url()
If I change the filter for example to product.url, which I know is indexed in ElasticSearch, it works.
What could be the issue here?
I made my own query for the product in ElasticSearch so you can see what it looks like in the ES index.
Query:
Result, some fields I deem irrelevant have been omitted:
Aimeos Laravel version: ~2023.04
PHP Version: 8.2.7
Environment: Linux
Locale: Bulgarian
Hello,
I'm having problems getting to the product details page.
I have traced the error to this method:
Aimeos\Controller\Frontend\Product::resolve()
Code: Select all
/**
* Returns the product for the given product URL name
*
* @param string $name Product URL name
* @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items
* @since 2019.04
*/
public function resolve( string $name ) : \Aimeos\MShop\Product\Item\Iface
{
$search = $this->manager->filter( null )->slice( 0, 1 )->add( ['index.text:url()' => $name] );
if( ( $item = $this->manager->search( $search, $this->domains )->first() ) === null )
{
$msg = $this->context()->translate( 'controller/frontend', 'Unable to find product "%1$s"' );
throw new \Aimeos\Controller\Frontend\Product\Exception( sprintf( $msg, $name ), 404 );
}
return \Aimeos\MShop::create( $this->context(), 'rule' )->apply( $item, 'catalog' );
}
If I change the filter for example to product.url, which I know is indexed in ElasticSearch, it works.
What could be the issue here?
I made my own query for the product in ElasticSearch so you can see what it looks like in the ES index.
Query:
Code: Select all
curl -X POST 'localhost:9200/aimeos/_search' -H 'Content-Type: application/json' -d '
{
"query": {
"bool": {
"should": [
{ "base.product.id": <Product ID> }
]
}
}
}
'
Result, some fields I deem irrelevant have been omitted:
Code: Select all
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"hits" : [
{
"_index" : "aimeos",
"_id" : "<Product ID>",
"_source" : {
"base" : {
"product.id" : "<PRODUCT ID>",
"product.siteid" : "1.",
"product.ctime" : "2023-02-02 01:16:00",
"product.mtime" : "2023-06-19 14:40:29",
"product.editor" : "aimeos:jobs",
"seen" : 0,
"orders" : 0,
"product.url" : "<PRODUCT URL>",
"product.type" : "book",
"product.status" : 1,
"product.dataset" : "",
"product.datestart" : null,
"product.dateend" : null,
"product.scale" : 1.0,
"product.target" : "",
"product.ratings" : 0,
"product.rating" : "0.00",
"product.instock" : 1,
"product.boost" : 1.0
},
"domains" : [
"attribute",
"catalog",
"media",
"price",
"text"
],
"index.siteid" : [
"1."
],
"index.price:value(BGN)" : 16.0,
"index.text:url(bg)" : "<Product URL>",
"index.text:name(bg)" : "<Product Name>",
"index.text:url(en)" : "<Product URL>",
"index.text:name(en)" : "<Product Name>",
}
}
]
}
}
Last edited by kdim95 on 20 Jun 2023, 07:26, edited 1 time in total.
Re: ElasticSearch - Unable to find product "<Product URL>"
Seems like there was an issue in the resolve() method as it didn't pass the language ID.
Can you update to aimeos/ai-controller-frontend:2023.04.x-dev and see if it works with the latest commit?
Can you update to aimeos/ai-controller-frontend:2023.04.x-dev and see if it works with the latest commit?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: ElasticSearch - Unable to find product "<Product URL>"
Thank you, it didn't work at first, but after doing php artisan aimeos:jobs index/rebuild it worked.
Should I remove the "x-dev" package from my composer.json at some point when there is an update to 2023.04 ?
Should I remove the "x-dev" package from my composer.json at some point when there is an update to 2023.04 ?
Re: ElasticSearch - Unable to find product "<Product URL>"
A new release of the aimeos/ai-controller-frontend package has been released and you can remove .x-dev now again.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: ElasticSearch - Unable to find product "<Product URL>"
Thank you, I've removed the x-dev package and rebuild the index again, there are no issues with the product URLs.