MacFJA / php-redisearch

PHP Client for RediSearch
MIT License
67 stars 9 forks source link

PaginatedResponse does not have access to $this->client #30

Closed pierrexp9 closed 2 years ago

pierrexp9 commented 2 years ago

Hello MacFJA, (I'm using version 2.1.0)

I get a

Call to a member function execute() on null
at vendor/macfja/redisearch/src/Redis/Response/PaginatedResponse.php:145

It appears that $this->client is null.

When I set the setLimit to a high enough value, I dont get this error anymore.

Another workaround is to manually set the client like this

 /** @var PaginatedResponse $results */
$results = $client->execute($search);
$results->setClient($client);
MacFJA commented 2 years ago

The error you have is caused by the PaginatedResponse trying to request the next page. But as the Search command don't know the client, so it can't give it to the response. So you have the tell the PaginatedResponse what is the client to use.


But I guess I can make a more developer friendly error

pierrexp9 commented 2 years ago

Allright, thanks for the explanation!