SearchClient class final

Implemented types
Available Extensions

Constructors

SearchClient({required String appId, required String apiKey, ClientOptions options = const ClientOptions()})

Properties

apiKey String
The API key used for authentication.
final
appId String
The unique identifier for the application using the API client.
final
hashCode int
The hash code for this object.
no setterinherited
options ClientOptions
A set of custom client options to configure the behavior of the API client.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addApiKey({required ApiKey apiKey, RequestOptions? requestOptions}) Future<AddApiKeyResponse>
Creates a new API key with specific permissions and restrictions.
addOrUpdateObject({required String indexName, required String objectID, required Object body, RequestOptions? requestOptions}) Future<UpdatedAtWithObjectIdResponse>
If a record with the specified object ID exists, the existing record is replaced. Otherwise, a new record is added to the index. To update some attributes of an existing record, use the partial operation instead. To add, update, or replace multiple records, use the batch operation.
appendSource({required Source source, RequestOptions? requestOptions}) Future<CreatedAtResponse>
Adds a source to the list of allowed sources.
assignUserId({required String xAlgoliaUserID, required AssignUserIdParams assignUserIdParams, RequestOptions? requestOptions}) Future<CreatedAtResponse>
Assigns or moves a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.
batch({required String indexName, required BatchWriteParams batchWriteParams, RequestOptions? requestOptions}) Future<BatchResponse>
Adds, updates, or deletes records in one index with a single API request. Batching index updates reduces latency and increases data integrity. - Actions are applied in the order they're specified. - Actions are equivalent to the individual API requests of the same name.
batchAssignUserIds({required String xAlgoliaUserID, required BatchAssignUserIdsParams batchAssignUserIdsParams, RequestOptions? requestOptions}) Future<CreatedAtResponse>
Assigns multiple user IDs to a cluster. You can't move users with this operation.
batchDictionaryEntries({required DictionaryType dictionaryName, required BatchDictionaryEntriesParams batchDictionaryEntriesParams, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
browse({required String indexName, dynamic browseParams, RequestOptions? requestOptions}) Future<BrowseResponse>
Retrieves records from an index, up to 1,000 per request. While searching retrieves hits (records augmented with attributes for highlighting and ranking details), browsing just returns matching records. This can be useful if you want to export your indices. - The Analytics API doesn't collect data when using browse. - Records are ranked by attributes and custom ranking. - Deduplication (distinct) is turned off. - There's no ranking for: typo-tolerance, number of matched words, proximity, geo distance.
clearObjects({required String indexName, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Deletes only the records from an index while keeping settings, synonyms, and rules.
clearRules({required String indexName, bool? forwardToReplicas, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Deletes all rules from the index.
clearSynonyms({required String indexName, bool? forwardToReplicas, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Deletes all synonyms from the index.
customDelete({required String path, Map<String, Object>? parameters, RequestOptions? requestOptions}) Future<Object>
This method allow you to send requests to the Algolia REST API.
customGet({required String path, Map<String, Object>? parameters, RequestOptions? requestOptions}) Future<Object>
This method allow you to send requests to the Algolia REST API.
customPost({required String path, Map<String, Object>? parameters, Object? body, RequestOptions? requestOptions}) Future<Object>
This method allow you to send requests to the Algolia REST API.
customPut({required String path, Map<String, Object>? parameters, Object? body, RequestOptions? requestOptions}) Future<Object>
This method allow you to send requests to the Algolia REST API.
del({required String path, Map<String, Object>? parameters, Object? body, RequestOptions? requestOptions}) Future<Object>
deleteApiKey({required String key, RequestOptions? requestOptions}) Future<DeleteApiKeyResponse>
Deletes the API key.
deleteBy({required String indexName, required DeleteByParams deleteByParams, RequestOptions? requestOptions}) Future<DeletedAtResponse>
This operation doesn't accept empty queries or filters. It's more efficient to get a list of object IDs with the browse operation, and then delete the records using the batch operation.
deleteIndex({required String indexName, RequestOptions? requestOptions}) Future<DeletedAtResponse>
Deletes an index and all its settings. - Deleting an index doesn't delete its analytics data. - If you try to delete a non-existing index, the operation is ignored without warning. - If the index you want to delete has replica indices, the replicas become independent indices. - If the index you want to delete is a replica index, you must first unlink it from its primary index before you can delete it. For more information, see Delete replica indices.
deleteObject({required String indexName, required String objectID, RequestOptions? requestOptions}) Future<DeletedAtResponse>
Deletes a record by its object ID. To delete more than one record, use the batch operation. To delete records matching a query, use the deleteByQuery operation.
deleteRule({required String indexName, required String objectID, bool? forwardToReplicas, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Deletes a rule by its ID. To find the object ID for rules, use the search operation.
deleteSource({required String source, RequestOptions? requestOptions}) Future<DeleteSourceResponse>
Deletes a source from the list of allowed sources.
deleteSynonym({required String indexName, required String objectID, bool? forwardToReplicas, RequestOptions? requestOptions}) Future<DeletedAtResponse>
Deletes a synonym by its ID. To find the object IDs of your synonyms, use the search operation.
dispose() → void
Dispose of underlying resources.
override
get({required String path, Map<String, Object>? parameters, Object? body, RequestOptions? requestOptions}) Future<Object>
getApiKey({required String key, RequestOptions? requestOptions}) Future<GetApiKeyResponse>
Gets the permissions and restrictions of an API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key.
getAppTask({required int taskID, RequestOptions? requestOptions}) Future<GetTaskResponse>
Checks the status of a given application task.
getDictionaryLanguages({RequestOptions? requestOptions}) Future<Map<String, Languages>>
Lists supported languages with their supported dictionary types and number of custom entries.
getDictionarySettings({RequestOptions? requestOptions}) Future<GetDictionarySettingsResponse>
Retrieves the languages for which standard dictionary entries are turned off.
getLogs({int? offset, int? length, String? indexName, LogType? type, RequestOptions? requestOptions}) Future<GetLogsResponse>
The request must be authenticated by an API key with the logs ACL. - Logs are held for the last seven days. - Up to 1,000 API requests per server are logged. - This request counts towards your operations quota but doesn't appear in the logs itself.
getObject({required String indexName, required String objectID, List<String>? attributesToRetrieve, RequestOptions? requestOptions}) Future<Map<String, String>>
Retrieves one record by its object ID. To retrieve more than one record, use the objects operation.
getObjects({required GetObjectsParams getObjectsParams, RequestOptions? requestOptions}) Future<GetObjectsResponse>
Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
getRule({required String indexName, required String objectID, RequestOptions? requestOptions}) Future<Rule>
Retrieves a rule by its ID. To find the object ID of rules, use the search operation.
getSettings({required String indexName, RequestOptions? requestOptions}) Future<IndexSettings>
Retrieves an object with non-null index settings.
getSources({RequestOptions? requestOptions}) Future<List<Source>>
Retrieves all allowed IP addresses with access to your application.
getSynonym({required String indexName, required String objectID, RequestOptions? requestOptions}) Future<SynonymHit>
Retrieves a syonym by its ID. To find the object IDs for your synonyms, use the search operation.
getTask({required String indexName, required int taskID, RequestOptions? requestOptions}) Future<GetTaskResponse>
Checks the status of a given task. Indexing tasks are asynchronous. When you add, update, or delete records or indices, a task is created on a queue and completed depending on the load on the server. The indexing tasks' responses include a task ID that you can use to check the status.
getTopUserIds({RequestOptions? requestOptions}) Future<GetTopUserIdsResponse>
Get the IDs of the 10 users with the highest number of records per cluster. Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.
getUserId({required String userID, RequestOptions? requestOptions}) Future<UserId>
Returns the user ID data stored in the mapping. Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.
hasPendingMappings({bool? getClusters, RequestOptions? requestOptions}) Future<HasPendingMappingsResponse>
To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.
listApiKeys({RequestOptions? requestOptions}) Future<ListApiKeysResponse>
Lists all API keys associated with your Algolia application, including their permissions and restrictions.
listClusters({RequestOptions? requestOptions}) Future<ListClustersResponse>
Lists the available clusters in a multi-cluster setup.
listIndices({int? page, int? hitsPerPage, RequestOptions? requestOptions}) Future<ListIndicesResponse>
Lists all indices in the current Algolia application. The request follows any index restrictions of the API key you use to make the request.
listUserIds({int? page, int? hitsPerPage, RequestOptions? requestOptions}) Future<ListUserIdsResponse>
Lists the userIDs assigned to a multi-cluster application. Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.
multipleBatch({required BatchParams batchParams, RequestOptions? requestOptions}) Future<MultipleBatchResponse>
Adds, updates, or deletes records in multiple indices with a single API request. - Actions are applied in the order they are specified. - Actions are equivalent to the individual API requests of the same name.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
operationIndex({required String indexName, required OperationIndexParams operationIndexParams, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for their analytics data. - If the destination index doesn't exist yet, it'll be created. Copy - Copying a source index that doesn't exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can't copy the enableReRanking, mode, and replicas settings. - You can't copy to a destination index that already has replicas. - Be aware of the size limits. - Related guide: Copy indices Move - Moving a source index that doesn't exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: Move indices.
partialUpdateObject({required String indexName, required String objectID, required Map<String, dynamic> attributesToUpdate, bool? createIfNotExists, RequestOptions? requestOptions}) Future<UpdatedAtWithObjectIdResponse>
Adds new attributes to a record, or update existing ones. - If a record with the specified object ID doesn't exist, a new record is added to the index if createIfNotExists is true. - If the index doesn't exist yet, this method creates a new index. - You can use any first-level attribute but not nested attributes. If you specify a nested attribute, the engine treats it as a replacement for its first-level ancestor.
post({required String path, Map<String, Object>? parameters, Object? body, RequestOptions? requestOptions}) Future<Object>
put({required String path, Map<String, Object>? parameters, Object? body, RequestOptions? requestOptions}) Future<Object>
removeUserId({required String userID, RequestOptions? requestOptions}) Future<RemoveUserIdResponse>
Deletes a user ID and its associated data from the clusters.
replaceSources({required List<Source> source, RequestOptions? requestOptions}) Future<ReplaceSourceResponse>
Replaces the list of allowed sources.
restoreApiKey({required String key, RequestOptions? requestOptions}) Future<AddApiKeyResponse>
Restores a deleted API key. Restoring resets the validity attribute to 0. Algolia stores up to 1,000 API keys per application. If you create more, the oldest API keys are deleted and can't be restored.
saveObject({required String indexName, required Object body, RequestOptions? requestOptions}) Future<SaveObjectResponse>
Adds a record to an index or replace it. - If the record doesn't have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn't exist, a new record is added to your index. - If you add a record to an index that doesn't exist yet, a new index is created. To update some attributes of a record, use the partial operation. To add, update, or replace multiple records, use the batch operation.
saveRule({required String indexName, required String objectID, required Rule rule, bool? forwardToReplicas, RequestOptions? requestOptions}) Future<UpdatedRuleResponse>
If a rule with the specified object ID doesn't exist, it's created. Otherwise, the existing rule is replaced. To create or update more than one rule, use the batch operation.
saveRules({required String indexName, required List<Rule> rules, bool? forwardToReplicas, bool? clearExistingRules, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Create or update multiple rules. If a rule with the specified object ID doesn't exist, Algolia creates a new one. Otherwise, existing rules are replaced.
saveSynonym({required String indexName, required String objectID, required SynonymHit synonymHit, bool? forwardToReplicas, RequestOptions? requestOptions}) Future<SaveSynonymResponse>
If a synonym with the specified object ID doesn't exist, Algolia adds a new one. Otherwise, the existing synonym is replaced. To add multiple synonyms in a single API request, use the batch operation.
saveSynonyms({required String indexName, required List<SynonymHit> synonymHit, bool? forwardToReplicas, bool? replaceExistingSynonyms, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
If a synonym with the objectID doesn't exist, Algolia adds a new one. Otherwise, existing synonyms are replaced.
Sends multiple search request to one or more indices. This can be useful in these cases: - Different indices for different purposes, such as, one index for products, another one for marketing content. - Multiple searches to the same index—for example, with different filters.
searchDictionaryEntries({required DictionaryType dictionaryName, required SearchDictionaryEntriesParams searchDictionaryEntriesParams, RequestOptions? requestOptions}) Future<SearchDictionaryEntriesResponse>
Searches for standard and custom dictionary entries.
searchForFacetValues({required String indexName, required String facetName, SearchForFacetValuesRequest? searchForFacetValuesRequest, RequestOptions? requestOptions}) Future<SearchForFacetValuesResponse>
Searches for values of a specified facet attribute. - By default, facet values are sorted by decreasing count. You can adjust this with the sortFacetValueBy parameter. - Searching for facet values doesn't work if you have more than 65 searchable facets and searchable attributes combined.
searchRules({required String indexName, SearchRulesParams? searchRulesParams, RequestOptions? requestOptions}) Future<SearchRulesResponse>
Searches for rules in your index.
searchSingleIndex({required String indexName, dynamic searchParams, RequestOptions? requestOptions}) Future<SearchResponse>
Searches a single index and return matching search results (hits). This method lets you retrieve up to 1,000 hits. If you need more, use the browse operation or increase the paginatedLimitedTo index setting.
searchSynonyms({required String indexName, SearchSynonymsParams? searchSynonymsParams, RequestOptions? requestOptions}) Future<SearchSynonymsResponse>
Searches for synonyms in your index.
searchUserIds({required SearchUserIdsParams searchUserIdsParams, RequestOptions? requestOptions}) Future<SearchUserIdsResponse>
Since it can take a few seconds to get the data from the different clusters, the response isn't real-time. To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).
setDictionarySettings({required DictionarySettingsParams dictionarySettingsParams, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Turns standard stop word dictionary entries on or off for a given language.
setSettings({required String indexName, required IndexSettings indexSettings, bool? forwardToReplicas, RequestOptions? requestOptions}) Future<UpdatedAtResponse>
Update the specified index settings. Index settings that you don't specify are left unchanged. Specify null to reset a setting to its default value. For best performance, update the index settings before you add new records to your index.
toString() String
A string representation of this object.
inherited
updateApiKey({required String key, required ApiKey apiKey, RequestOptions? requestOptions}) Future<UpdateApiKeyResponse>
Replaces the permissions of an existing API key. Any unspecified attribute resets that attribute to its default value.

Operators

operator ==(Object other) bool
The equality operator.
inherited