Open web4exposure-org opened 1 year ago
Hello @web4exposure-org,
Thank you for the report. To better understand the issue, could you please provide:
bin/magento index:reindex
?Thanks in advance!
Hi,
The version of Magento you're using.
Magento 2.4.6-p1
Your Typesense configuration details (please omit any sensitive information).
Enabled: Enable Cloud ID: null Admin API Key: xyz Search Only Key: xyz Path: null Port: 8108 Protocol: http Index Method: Typesense Only
This is a local environment with typesense running within a docker, settings:
- Typesense 0.24.1
- Port: 8108
- Command: '--data-dir /data --api-key=xyz --enable-cors'
If available, any additional stack trace details. You might find these in var/logs.
When reindexing I get the following output:
bin/magento index:reindex algolia_categories algolia_products Algolia Search Products index process error during indexation process: implode(): Argument #2 ($array) must be of type ?array, string given Algolia Search Categories index process error during indexation process: No such entity with id = 20844
The only output from the logs is this:
==> var/log/system.log <== [2023-08-21T06:46:40.396406+00:00] main.CRITICAL: implode(): Argument #2 ($array) must be of type ?array, string given [] []
==> var/log/debug.log <== [2023-08-21T06:46:40.396406+00:00] main.CRITICAL: implode(): Argument #2 ($array) must be of type ?array, string given [] []
==> var/log/system.log <== [2023-08-21T06:46:55.768187+00:00] main.CRITICAL: No such entity with id = 20844 [] []
==> var/log/debug.log <== [2023-08-21T06:46:55.768187+00:00] main.CRITICAL: No such entity with id = 20844 [] []
Also, does this error appear when you execute bin/magento index:reindex?
> As stated in the previous answer, yes.
Hi @web4exposure-org,
I've been unable to replicate this. Can you please confirm you have nodes set to your Docker host?
bin/magento config:set typesense_general/settings/nodes 127.0.0.1
It's important to note that you must save this either in the command line or the backend of Magento, IE not directly in the database, as the indexes get created on save.
Hi, Yes I set this via the backend of magento. I'll try to set it up again in another environment to check if I get the same issue.
The product indexing error is in file Adapter/Client.php:deleteData If I put a return in this function before actually doing something, the whole product indexing works (but category indexing still doesnt work)
Hi @web4exposure-org - did you find a resolution to this one?
Hi, no, I still have the same problem on our staging environment. Are there some settings in the Algolia module I need to set? Or in the Typesense module?
The Typesense module extends the Algolia functionality, it adds an adapter to direct the indexing and search to your Typesense host, so you will need to configure Algolia to how you would like the autocomplete and instant search to display.
For Algolia to be set, you will need credentials in the Algolia configuration too. If you set Typesense index method to "Typesense Only", then it won't add any data to Algolia so you can just use a free demo account.
For Algolia to be set, you will need credentials in the Algolia configuration too.
Pretty important step which I didn't know!
Right now I have some updates after investigating the issues.
The following issue: No such entity with id = 20844
was caused by a missing parent category. (some categories had 20844 as a parent ID, but this ID did not exist. I fixed it by inserting a new category into the database with ID 20844 and this fixed this issue)
However, the issue with implode(): Argument #2 ($array) must be of type ?array, string given
is still occurring. I "fixed" this by adding a return;
at line 105 in Client.php
.
And a quick question; what's the difference between the Admin API key and Search only key, and how do I make sure this is set properly and securely? Right now I'm using the Typesense API key from my docker setup for both of these.
Hi @web4exposure-org - The admin api key will have write access where as the search only should only have read access.
I am not very familiar with the docker setup, I recommend running cloud https://cloud.typesense.org/
Hi, I want to come back at the following issue:
the issue with
implode(): Argument #2 ($array) must be of type ?array, string given
is still occurring. I "fixed" this by adding a return; at line 105 in Client.php.
The function deleteData() is getting an array with the following data as $indexName
array(1) { [4499]=> string(4) "4499" }
The $data
variable has the following value: testdefault_products
.
Because of this data, I guessed these variables should be switched. If I switch these variables, I get the following error: Parameter filter_by must be provided.
If I put the filter_by key to the searchParameters, indexing works as expected, although I do not know for sure if this is the right solution.
public function deleteData($indexName, $data)
{
$searchParameters = [
'q' => implode(",", $indexName),
'query_by' => 'objectID',
'filter_by' => ''
];
return $this->getTypesenseClient()->collections[$data]->documents->delete($searchParameters);
}
When reindexing the algolia search products index, I get the following error:
Algolia Search Products index process error during indexation process: implode(): Argument #2 ($array) must be of type ?array, string given
0 /vendor/develodesign/magento2-module-typesense/Adapter/Client.php(109): implode()
The input in the implode is
string(16) "default_products"
The search categories index gives me another error: Algolia Search Categories index process error during indexation process: No such entity with id = 20844