MeiliSearch
public struct MeiliSearch
A MeiliSearch instance represents a MeiliSearch client used to easily integrate
your Swift product with the MeiliSearch server.
Warning
MeiliSearch instances are thread safe and can be shared across threads
or dispatch queues.
-
Create an instance of MeiliSearch client.
Declaration
Swift
public init(host: String, apiKey: String? = nil, session: URLSessionProtocol? = nil, request: Request? = nil) throwsParameters
hostThe host to the MeiliSearch http server.
apiKeyThe authorisation key to communicate with MeiliSearch.
sessionA custom produced URLSessionProtocol.
-
Create a new index.
Declaration
Parameters
uidThe unique identifier for the
Indexto be created.primaryKeythe unique field of a document.
completion -
Get an index.
Declaration
-
List all indexes.
Declaration
Parameters
completionThe completion closure used to notify when the server completes the query request, it returns a
Resultobject that contains[Index]value. If the request was sucessful orErrorif a failure occured. -
Update the primaryKey of the index.
Declaration
Parameters
uidThe unique identifier of the index
primaryKeythe unique field of a document.
completionThe completion closure used to notify when the server completes the update request, it returns a
Resultobject that contains()value. If the request was sucessful orErrorif a failure occured. -
Delete an index.
Declaration
Swift
public func deleteIndex( _ uid: String, _ completion: @escaping (Result<(), Swift.Error>) -> Void)Parameters
uidThe unique identifier of the index.
completionThe completion closure used to notify when the server completes the delete request, it returns a
Resultobject that contains()value. If the request was sucessful orErrorif a failure occured.
-
Each instance of MeiliSearch has three keys: a master, a private, and a public. Each key has a given set of permissions on the API routes.
-
Get stats of all indexes.
Declaration
-
Get health of MeiliSearch server.
-
Get health of MeiliSearch server.
Declaration
Swift
public func isHealthy(_ completion: @escaping (Bool) -> Void)Parameters
completionThe completion closure used to notify when the server completes the query request, it returns a
Boolthat istrueIf the request was sucessful orfalseif a failure occured. -
Get version of MeiliSearch.
Declaration
-
Triggers a dump creation process. Once the process is complete, a dump is created in the dumps folder. If the dumps folder does not exist yet, it will be created.
Declaration
-
Get the status of a dump creation process using the uid returned after calling the dump creation route. The returned status could be:
Dump.Status.inProgress: Dump creation is in progress.Dump.Status.failed: An error occurred during the dump process, and the task was aborted.Dump.Status.done: Dump creation is finished and was successful.Declaration
-
Undocumented
See moreDeclaration
Swift
struct MSErrorResponse : Decodable, Encodable, Equatable -
Undocumented
Declaration
Swift
static func errorHandler(url: URL, data: Data?, response: URLResponse?, error: Swift.Error?) throws -
Generic Error types for MeiliSearch,
See moreDeclaration
Swift
enum Error : Swift.Error, LocalizedError, Equatable
MeiliSearch Structure Reference