You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Description
<!--- Describe the issue here -->
Im trying to integrate typesense in my symfony application for that i have written below code
TypesenseService.php
<?php
namespace App\Service;
use Typesense\Client;
class TypesenseService
{
private $typesenseClient;
public function __construct()
{
$this->typesenseClient = new Client([
'api_key' => 'exceloid-test',
'nodes' => [
[
'host' => '95.216.171.30',
'port' => '8092',
'protocol' => 'http',
],
],
'connection_timeout_seconds' => 2,
]);
}
public function getTypesenseClient(): Client
{
return $this->typesenseClient;
}
}
Productservice.php
<?php
namespace App\Service;
use Psr\Log\LoggerInterface;
class ProductService
{
private $typesenseService;
private $logger;
public function __construct(TypesenseService $typesenseService, LoggerInterface $logger)
{
$this->typesenseService = $typesenseService;
$this->logger = $logger;
}
public function getProducts(): array
{
$typesenseClient = $this->typesenseService->getTypesenseClient();
$searchParameters = [
'q' => 'banana',
'query_by' => 'shortName'
];
$searchResults = $typesenseClient->collections['Ofcproducts']->documents->search($searchParameters);
$products = [];
foreach ($searchResults['hits'] as $hit) {
$document = $hit['document'];
unset($document['document']);
$products[] = $document;
}
return $products;
// return $searchResults['hits'];
}
}
and when im trying to call this function in any controller
$typesenseProducts = $this->productService->getProducts();
im getting below error
Uncaught PHP Exception JsonException: "Syntax error" at /home/exceloid/OFC-ECOM/organic-api/vendor/typesense/typesense-php/src/ApiCall.php line 236
till 3 dec 2023 it was working fine ,but now getting syntax error from library
an someone pls help me
**Typesense Version**:4.8 or 4.9
**OS**: ubuntu
The text was updated successfully, but these errors were encountered:
I found out a potential cause, if you are running this behind a nginx or apache, check that the max upload size is good enough for a large json upload, that was what caused my issue, a fresh nginx install was 2mb by default
The text was updated successfully, but these errors were encountered: