public final class SearchClient extends Object implements Closeable, SearchClientMultipleOperations, SearchClientCopyOperations, SearchClientMcm, SearchClientAPIKeys, SearchClientPersonalization, SearchClientAdvanced
HttpTransport
which wraps the HttpClient This client allows to build typed requests and read typed responses.
Requests are made under the Algolia's retry-strategy. This client is intended to be reused and
it's thread-safe.| Constructor and Description |
|---|
SearchClient(SearchConfig config,
HttpRequester httpRequester)
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the underlying HttpClient and resources.
|
ConfigBase |
getConfig()
Get Client's configuration
|
com.algolia.search.HttpTransport |
getTransport() |
SearchIndex<?> |
initIndex(String indexName)
Get the index object initialized (no server call needed for initialization)
|
<T> SearchIndex<T> |
initIndex(String indexName,
Class<T> clazz)
Get the index object initialized (no server call needed for initialization)
|
void |
waitTask(String indexName,
long taskID)
Wait for a task to complete before executing the next line of code, to synchronize index
updates.
|
void |
waitTask(String indexName,
long taskID,
long timeToWait)
Wait for a task to complete before executing the next line of code, to synchronize index
updates.
|
void |
waitTask(String indexName,
long taskID,
long timeToWait,
RequestOptions requestOptions)
Wait for a task to complete before executing the next line of code, to synchronize index
updates.
|
void |
waitTask(String indexName,
long taskID,
RequestOptions requestOptions)
Wait for a task to complete before executing the next line of code, to synchronize index
updates.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmultipleBatch, multipleBatch, multipleBatchAsync, multipleBatchAsync, multipleGetObjects, multipleGetObjects, multipleGetObjectsAsync, multipleGetObjectsAsync, multipleQueries, multipleQueries, multipleQueriesAsync, multipleQueriesAsynccheckIndicesBeforeMoving, copyIndex, copyIndex, copyIndex, copyIndexAsync, copyIndexAsync, copyIndexAsync, copyRules, copyRules, copyRulesAsync, copyRulesAsync, copySettings, copySettings, copySettingsAsync, copySettingsAsync, copySynonyms, copySynonyms, copySynonymsAsync, copySynonymsAsync, moveIndex, moveIndex, moveIndexAsync, moveIndexAsyncassignUserID, assignUserID, assignUserIDAsync, assignUserIDAsync, getTopUserID, getTopUserID, getTopUserIDAsync, getTopUserIDAsync, getUserID, getUserID, getUserIDAsync, getUserIDAsync, listClusters, listClusters, listClustersAsync, listClustersAsync, listUserIDs, listUserIDs, listUserIDs, listUserIDsAsync, listUserIDsAsync, listUserIDsAsync, removeUserID, removeUserID, removeUserIDAsync, removeUserIDAsync, searchUserIDs, searchUserIDs, searchUserIDsAsync, searchUserIDsAsyncaddApiKey, addApiKey, addApiKeyAsync, addApiKeyAsync, deleteApiKey, deleteApiKey, deleteApiKeyAsync, deleteApiKeyAsync, generateSecuredAPIKey, getApiKey, getApiKey, getApiKeyAsync, getApiKeyAsync, listApiKeys, listApiKeys, listApiKeysAsync, listApiKeysAsync, restoreApiKey, restoreApiKey, restoreApiKeyAsync, restoreApiKeyAsync, updateApiKey, updateApiKey, updateApiKeyAsync, updateApiKeyAsyncgetPersonalizationStrategy, getPersonalizationStrategy, getPersonalizationStrategyAsync, getPersonalizationStrategyAsync, setPersonalizationStrategy, setPersonalizationStrategy, setPersonalizationStrategyAsync, setPersonalizationStrategyAsynccustomRequest, customRequest, customRequest, customRequest, customRequestAsync, customRequestAsync, customRequestAsync, customRequestAsync, getLogs, getLogs, getLogs, getLogs, getLogs, getLogsAsync, getLogsAsync, getLogsAsync, getLogsAsync, getLogsAsync, listIndices, listIndices, listIndicesAsync, listIndicesAsyncpublic SearchClient(@Nonnull SearchConfig config, @Nonnull HttpRequester httpRequester)
config - The configuration allows you to advanced configuration of the clients such as
batch size or custom hosts and timeout.httpRequester - Another HTTP Client than the default one. Must be an implementation of
HttpRequester.NullPointerException - If one of the following ApplicationID/ApiKey/Config/Requester is
nullIllegalArgumentException - If the ApplicationID or the APIKey are emptypublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - if an I/O error occurspublic com.algolia.search.HttpTransport getTransport()
getTransport in interface SearchClientBasepublic ConfigBase getConfig()
getConfig in interface SearchClientBasepublic SearchIndex<?> initIndex(@Nonnull String indexName)
indexName - The name of the Algolia indexIllegalArgumentException - When indexName is null or emptypublic <T> SearchIndex<T> initIndex(@Nonnull String indexName, @Nonnull Class<T> clazz)
T - the type of the objects in this indexindexName - The name of the Algolia indexclazz - class of the object in this indexIllegalArgumentException - When indexName is null or emptypublic void waitTask(@Nonnull String indexName, long taskID)
waitTask in interface SearchClientBaseindexName - The indexName to wait ontaskID - The Algolia taskIDAlgoliaRetryException - When the retry has failed on all hostsAlgoliaApiException - When the API sends an http error codeAlgoliaRuntimeException - When an error occurred during the serializationpublic void waitTask(@Nonnull String indexName, long taskID, long timeToWait)
indexName - The indexName to wait ontaskID - The Algolia taskIDtimeToWait - The time to wait between each callAlgoliaRetryException - When the retry has failed on all hostsAlgoliaApiException - When the API sends an http error codeAlgoliaRuntimeException - When an error occurred during the serializationpublic void waitTask(@Nonnull String indexName, long taskID, RequestOptions requestOptions)
indexName - The indexName to wait ontaskID - The Algolia taskIDrequestOptions - Options to pass to this requestAlgoliaRetryException - When the retry has failed on all hostsAlgoliaApiException - When the API sends an http error codeAlgoliaRuntimeException - When an error occurred during the serializationpublic void waitTask(@Nonnull String indexName, long taskID, long timeToWait, RequestOptions requestOptions)
waitTask in interface SearchClientBaseindexName - The indexName to wait ontaskID - The Algolia taskIDtimeToWait - The time to wait between each callrequestOptions - Options to pass to this requestAlgoliaRetryException - When the retry has failed on all hostsAlgoliaApiException - When the API sends an http error codeAlgoliaRuntimeException - When an error occurred during the serializationCopyright © 2019. All rights reserved.