public class Client extends AbstractClient
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 |
batchAsync(JSONArray operations,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Batch operations.
|
Request |
copyIndexAsync(String srcIndexName,
String dstIndexName,
CompletionHandler completionHandler)
Copy an existing index.
|
Request |
copyIndexAsync(String srcIndexName,
String dstIndexName,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Copy an existing index.
|
Request |
deleteIndexAsync(String indexName,
CompletionHandler completionHandler)
Delete an index.
|
Request |
deleteIndexAsync(String indexName,
RequestOptions requestOptions,
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 |
listIndexesAsync(RequestOptions requestOptions,
CompletionHandler completionHandler)
List existing indexes.
|
Request |
moveIndexAsync(String srcIndexName,
String dstIndexName,
CompletionHandler completionHandler)
Move an existing index.
|
Request |
moveIndexAsync(String srcIndexName,
String dstIndexName,
RequestOptions requestOptions,
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.
|
Request |
multipleQueriesAsync(List<IndexQuery> queries,
Client.MultipleQueriesStrategy strategy,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Run multiple queries, potentially targeting multiple indexes, with one API call.
|
addUserAgent, getConnectTimeout, getHeader, getHostDownDelay, getReadHosts, getReadTimeout, getSearchTimeout, getUserAgents, getWriteHosts, hasUserAgent, removeUserAgent, setCompletionExecutor, setConnectTimeout, setHeader, setHostDownDelay, setHosts, setReadHosts, setReadTimeout, setSearchTimeout, setWriteHostspublic Client(@NonNull
String applicationID,
@NonNull
String apiKey)
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)
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.indexName - The name of the index.@NonNull public Index getIndex(@NonNull String indexName)
indexName - The name of the index.public Request listIndexesAsync(@Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request listIndexesAsync(@NonNull CompletionHandler completionHandler)
completionHandler - The listener that will be notified of the request's outcome.public Request deleteIndexAsync(@NonNull String indexName, @Nullable RequestOptions requestOptions, CompletionHandler completionHandler)
indexName - Name of index to delete.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request deleteIndexAsync(@NonNull String indexName, CompletionHandler completionHandler)
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, @Nullable RequestOptions requestOptions, CompletionHandler completionHandler)
srcIndexName - Name of index to move.dstIndexName - The new index name.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request moveIndexAsync(@NonNull String srcIndexName, @NonNull String dstIndexName, CompletionHandler completionHandler)
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, @Nullable RequestOptions requestOptions, CompletionHandler completionHandler)
srcIndexName - Name of index to copy.dstIndexName - The new index name.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request copyIndexAsync(@NonNull String srcIndexName, @NonNull String dstIndexName, CompletionHandler completionHandler)
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, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
queries - The queries to run.strategy - The strategy to use.requestOptions - Request-specific options.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)
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, @Nullable RequestOptions requestOptions, CompletionHandler completionHandler)
operations - List of operations.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request batchAsync(@NonNull JSONArray operations, CompletionHandler completionHandler)
operations - List of operations.completionHandler - The listener that will be notified of the request's outcome.