-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
We're using v4.4.0 and filters don't seem to work when using SearchClient::searchSingleIndex()
Either I'm doing something wrong or filters in query parameters are not taken into account when searching (Please see below reproducible scenario)
I've also tried this but because searchSingleIndex
create bodyless requestOptions below body attribute just gets overridden.
...
$searchResponse = $client->searchSingleIndex(
indexName: $indexName,
searchParams: ['query' => ''],
requestOptions: [
'body' => [
'filters' => 'value=1',
],
],
);
...
Language
PHP
Client
Search
Steps to reproduce
<?php
// File: hello_algolia.php
require_once realpath(__DIR__ . "/vendor/autoload.php");
use Algolia\AlgoliaSearch\Api\SearchClient;
$appID = "ALGOLIA_APPLICATION_ID";
// API key with `addObject` and `search` ACL
$apiKey = "ALGOLIA_API_KEY";
$indexName = "test-index";
$client = SearchClient::create($appID, $apiKey);
// Create a new record
$record = [
"objectID" => "object-1",
"name" => "test record",
"value" => "1",
];
$record2 = [
"objectID" => "object-2",
"name" => "test record 2",
"value" => "2",
];
// Add the record to an index
$client->saveObject($indexName, $record);
$client->saveObject($indexName, $record2);
// Search for ''
$searchResponse = $client->searchSingleIndex(
indexName: $indexName,
searchParams: ['query' => ''],
requestOptions: [
'queryParameters' => [
'filters' => 'value=1',
],
],
);
echo json_encode($searchResponse);
// Return both of the records
Relevant log output
No response
Self-service
- I'd be willing to fix this bug myself.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working