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) throws
Parameters
host
The host to the MeiliSearch http server.
apiKey
The authorisation key to communicate with MeiliSearch.
session
A custom produced URLSessionProtocol.
-
Create a new index.
Declaration
Parameters
uid
The unique identifier for the
Index
to be created.primaryKey
the unique field of a document.
completion
-
Get an index.
Declaration
-
List all indexes.
Declaration
Parameters
completion
The completion closure used to notify when the server completes the query request, it returns a
Result
object that contains[Index]
value. If the request was sucessful orError
if a failure occured. -
Update the primaryKey of the index.
Declaration
Parameters
uid
The unique identifier of the index
primaryKey
the unique field of a document.
completion
The completion closure used to notify when the server completes the update request, it returns a
Result
object that contains()
value. If the request was sucessful orError
if a failure occured. -
Delete an index.
Declaration
Swift
public func deleteIndex( _ uid: String, _ completion: @escaping (Result<(), Swift.Error>) -> Void)
Parameters
uid
The unique identifier of the index.
completion
The completion closure used to notify when the server completes the delete request, it returns a
Result
object that contains()
value. If the request was sucessful orError
if 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
completion
The completion closure used to notify when the server completes the query request, it returns a
Bool
that istrue
If the request was sucessful orfalse
if 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