public class Client extends AbstractClient
Entry point to the Android API. You must instantiate a Client object with your application ID and API key to start using Algolia Search API.
WARNING: For performance reasons, arguments to asynchronous methods are not cloned. Therefore, you should not modify mutable arguments after they have been passed (unless explicitly noted).
| Modifier and Type | Class and Description |
|---|---|
static class |
Client.MultipleQueriesStrategy
Strategy when running multiple queries.
|
AbstractClient.LibraryVersion| Constructor and Description |
|---|
Client(String applicationID,
String apiKey)
Create a new Algolia Search client targeting the default hosts.
|
Client(String applicationID,
String apiKey,
String[] hosts)
Create a new Algolia Search client with explicit hosts to target.
|
| Modifier and Type | Method and Description |
|---|---|
Request |
batchAsync(JSONArray operations,
CompletionHandler completionHandler)
Batch operations.
|
Request |
copyIndexAsync(String srcIndexName,
String dstIndexName,
CompletionHandler completionHandler)
Copy an existing index.
|
Request |
deleteIndexAsync(String indexName,
CompletionHandler completionHandler)
Delete an index.
|
String |
getApplicationID() |
Index |
getIndex(String indexName)
Obtain a proxy to an Algolia index (no server call required by this method).
|
Index |
initIndex(String indexName)
Deprecated.
You should now use
getIndex(String), which re-uses instances with the same name. |
Request |
listIndexesAsync(CompletionHandler completionHandler)
List existing indexes.
|
Request |
moveIndexAsync(String srcIndexName,
String dstIndexName,
CompletionHandler completionHandler)
Move an existing index.
|
Request |
multipleQueriesAsync(List<IndexQuery> queries,
Client.MultipleQueriesStrategy strategy,
CompletionHandler completionHandler)
Run multiple queries, potentially targeting multiple indexes, with one API call.
|
addUserAgent, getConnectTimeout, getHeader, getHostDownDelay, getReadHosts, getReadTimeout, getSearchTimeout, getUserAgents, getWriteHosts, hasUserAgent, removeUserAgent, setConnectTimeout, setHeader, setHostDownDelay, setHosts, setReadHosts, setReadTimeout, setSearchTimeout, setWriteHostspublic Client(@NonNull
String applicationID,
@NonNull
String apiKey)
Create a new Algolia Search client targeting the default hosts.
NOTE: This is the recommended way to initialize a client is most use cases.
applicationID - The application ID (available in your Algolia Dashboard).apiKey - A valid API key for the service.public Client(@NonNull
String applicationID,
@NonNull
String apiKey,
@Nullable
String[] hosts)
Create a new Algolia Search client with explicit hosts to target.
NOTE: In most use cases, you should the default hosts. See Client(String, String).
applicationID - The application ID (available in your Algolia Dashboard).apiKey - A valid API key for the service.hosts - An explicit list of hosts to target, or null to use the default hosts.@NonNull public String getApplicationID()
getApplicationID in class AbstractClientpublic Index initIndex(@NonNull String indexName)
getIndex(String), which re-uses instances with the same name.Create a proxy to an Algolia index (no server call required by this method).
indexName - The name of the index.@NonNull public Index getIndex(@NonNull String indexName)
Obtain a proxy to an Algolia index (no server call required by this method).
indexName - The name of the index.public Request listIndexesAsync(@NonNull CompletionHandler completionHandler)
List existing indexes.
completionHandler - The listener that will be notified of the request’s outcome.public Request deleteIndexAsync(@NonNull String indexName, CompletionHandler completionHandler)
Delete an index.
indexName - Name of index to delete.completionHandler - The listener that will be notified of the request’s outcome.public Request moveIndexAsync(@NonNull String srcIndexName, @NonNull String dstIndexName, CompletionHandler completionHandler)
Move an existing index. If the destination index already exists, its specific API keys will be preserved and the source index specific API keys will be added.
srcIndexName - Name of index to move.dstIndexName - The new index name.completionHandler - The listener that will be notified of the request’s outcome.public Request copyIndexAsync(@NonNull String srcIndexName, @NonNull String dstIndexName, CompletionHandler completionHandler)
Copy an existing index. If the destination index already exists, its specific API keys will be preserved and the source index specific API keys will be added.
srcIndexName - Name of index to copy.dstIndexName - The new index name.completionHandler - The listener that will be notified of the request’s outcome.public Request multipleQueriesAsync(@NonNull List<IndexQuery> queries, Client.MultipleQueriesStrategy strategy, @NonNull CompletionHandler completionHandler)
Run multiple queries, potentially targeting multiple indexes, with one API call.
queries - The queries to run.strategy - The strategy to use.completionHandler - The listener that will be notified of the request’s outcome.public Request batchAsync(@NonNull JSONArray operations, CompletionHandler completionHandler)
Batch operations.
operations - List of operations.completionHandler - The listener that will be notified of the request’s outcome.