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
Tests are also a good place to know how the library works internally: test
Note: When using this library in a user-facing app, please be sure to use an API Key that only allows search operations instead of the master API key. See keys.dart for an example of how to generate a search only API key.
See Configuration class for a list of all client configuration options.
Examples
import'dart:io';
import'package:typesense/typesense.dart';
voidmain() async {
// Replace with your configurationfinal host =InternetAddress.loopbackIPv4.address, protocol =Protocol.http;
final config =Configuration(
// Api key'xyz',
nodes: {
Node(
protocol,
host,
port:7108,
),
Node.withUri(
Uri(
scheme:'http',
host: host,
port:8108,
),
),
Node(
protocol,
host,
port:9108,
),
},
numRetries:3, // A total of 4 tries (1 original try + 3 retries)
connectionTimeout:constDuration(seconds:2),
);
final client =Client(config);
final searchParameters = {
'q':'stark',
'query_by':'company_name',
'filter_by':'num_employees:>100',
'sort_by':'num_employees:desc'
};
await client.collection('companies').documents.search(searchParameters);
}
The examples that walk you through on how to use the client: main.dart