Trouble Spotting API Error in Dart vs Shell Operations
TLDR Erick is having issues with the typesense API, receiving errors in Dart that are not present in shell operations. Despite Kishore Nallan trying to help, no solution has been found, leading Erick to post the issue on the dart client repository.
Feb 01, 2022 (20 months ago)
Erick
02:37 PMvalue
should be a string or a string array."}".value specs:
{
"facet": false,
"index": true,
"name": "value",
"optional": false,
"type": "float"
},
Erick
02:37 PMErick
02:39 PM401: {"message": "Forbidden - a valid
x-typesense-api-key header must be sent."}
Erick
02:42 PMErick
03:10 PMErick
03:11 PMKishore Nallan
03:11 PMErick
03:13 PMKishore Nallan
03:14 PMErick
03:14 PMawait client!.collection(collection).documents.search({
"q": value ?? "*",
"query_by": queryBy,
});
Kishore Nallan
03:16 PMErick
03:16 PMErick
03:19 PMclass SearchService {
Client? client;
String searchOne = "add-endpoint-here";
String searchTwo = "add-endpoint-here";
String searchThree = "add-endpoint-here";
void initialize(String searchKey) {
var config = Configuration(
searchKey,
nodes: {
Node(Protocol.https, searchOne, port: 443),
Node(Protocol.https, searchTwo, port: 443),
Node(Protocol.https, searchThree, port: 443),
},
connectionTimeout: Duration(seconds: 2),
);
client = Client(config);
}
Future<dynamic> Search(
String? value,
String queryBy,
String collection,
) async {
try {
var search = await client!.collection(collection).documents.search({
"q": value ?? "*",
"query_by": queryBy,
});
return search;
} catch(err){
return err;
}
}
Kishore Nallan
03:24 PMErick
03:29 PMSearch-only key = error
Admin key = error
Erick
03:30 PMErick
03:30 PMKishore Nallan
03:30 PMErick
03:36 PMErick
03:44 PMErick
03:44 PMKishore Nallan
03:45 PMErick
03:45 PMKishore Nallan
03:45 PMErick
03:46 PMErick
04:04 PMKishore Nallan
04:04 PMTypesense
Indexed 2764 threads (79% resolved)
Similar Threads
Understanding and Implementing Typesense Dart Library with Flutter
Alexandro sought help with the Typesense Dart library. Jason explained that the library is in progress, discussed utilizing other HTTP libraries, and provided detailed instructions on utilizing Typesense with Flutter. Alexandro provided feedback on the Typesense UI and expressed interest in creating a tutorial video.



Troubleshooting TypeScript Error with Typesense
GM experienced an error with Typesense in TypeScript, requiring help to correct the issues. Jason helped propose solutions and adjustments to the code. Ultimately, they were able to resolve the errors and successfully implement a search function.


Query Parameters Issue in Using Typesense with Flutter
Shane was having issues with query parameters when using the Typesense package in a Flutter app. Kishore Nallan advised to avoid using the preset parameter, and the issue was resolved when Shane directly specified 'query_by'. Kishore Nallan will investigate the likely issue with the Flutter client.
Trouble with Scoped Search API Keys in Flutter App
Shane struggled with scoped search API keys in Typesense library for a Flutter app, which returned a 401 error. Jason identified that the error may be a result of an invalid filter within the key, and instructed to create separate keys for different permissions. On implementation, the error was resolved.

Querying with Not-in in Typesense
Masahiro inquired about using not-in queries in Typesense. Kishore Nallan explained how to conduct such queries by using the "-" operator in the query string, and assisted Masahiro with issues stemming from a high number of exclusion tokens. The problem was eventually resolved by switching to the `multi_search` endpoint.


