public class Index extends Searchable
You cannot construct this class directly. Please use Client.getIndex(String) to obtain an instance.
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 | Field and Description |
|---|---|
static int |
DEFAULT_SETTINGS_VERSION |
| Modifier and Type | Method and Description |
|---|---|
JSONObject |
addObject(JSONObject obj,
RequestOptions requestOptions)
Adds an object in this index.
|
JSONObject |
addObject(JSONObject obj,
String objectID,
RequestOptions requestOptions)
Adds an object in this index.
|
Request |
addObjectAsync(JSONObject object,
CompletionHandler completionHandler)
Adds an object to this index (asynchronously).
|
Request |
addObjectAsync(JSONObject object,
String objectID,
CompletionHandler completionHandler)
Adds an object to this index, assigning it the specified object ID (asynchronously).
|
Request |
addObjectAsync(JSONObject object,
String objectID,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Adds an object to this index, assigning it the specified object ID (asynchronously).
|
JSONObject |
addObjects(JSONArray inputArray,
RequestOptions requestOptions)
Adds several objects.
|
Request |
addObjectsAsync(JSONArray objects,
CompletionHandler completionHandler)
Adds several objects to this index (asynchronously).
|
Request |
addObjectsAsync(JSONArray objects,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Adds several objects to this index (asynchronously).
|
Request |
browseAsync(Query query,
CompletionHandler completionHandler)
Browse all index content (initial call).
|
Request |
browseAsync(Query query,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Browse all index content (initial call).
|
Request |
browseFromAsync(String cursor,
CompletionHandler completionHandler)
Browse the index from a cursor.
|
Request |
browseFromAsync(String cursor,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Browse the index from a cursor.
|
JSONObject |
clearIndex(RequestOptions requestOptions)
Deletes the index content without removing settings and index specific API keys.
|
Request |
clearIndexAsync(CompletionHandler completionHandler)
Clear this index.
|
Request |
clearIndexAsync(RequestOptions requestOptions,
CompletionHandler completionHandler)
Clear this index.
|
void |
clearSearchCache()
Remove all entries from cache
|
JSONObject |
deleteBy(Query query)
Deletes all records matching the query.
|
JSONObject |
deleteBy(Query query,
RequestOptions requestOptions)
Deletes all records matching the query.
|
Request |
deleteByAsync(Query query,
CompletionHandler completionHandler)
Deletes all objects matching a query (helper).
|
Request |
deleteByAsync(Query query,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Deletes all objects matching a query (helper).
|
void |
deleteByQuery(Query query,
RequestOptions requestOptions)
Deprecated.
use
deleteBy(Query) instead. |
Request |
deleteByQueryAsync(Query query,
CompletionHandler completionHandler)
Deprecated.
use
deleteByAsync(Query, CompletionHandler) instead. |
Request |
deleteByQueryAsync(Query query,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Deprecated.
use
deleteByAsync(Query, CompletionHandler) instead. |
JSONObject |
deleteObject(String objectID,
RequestOptions requestOptions)
Deletes an object from the index.
|
Request |
deleteObjectAsync(String objectID,
CompletionHandler completionHandler)
Deletes an object from this index (asynchronously).
|
Request |
deleteObjectAsync(String objectID,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Deletes an object from this index (asynchronously).
|
JSONObject |
deleteObjects(Collection<String> objects,
RequestOptions requestOptions)
Deletes several objects.
|
Request |
deleteObjectsAsync(Collection<String> objectIDs,
CompletionHandler completionHandler)
Deletes several objects from this index (asynchronously).
|
Request |
deleteObjectsAsync(Collection<String> objectIDs,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Deletes several objects from this index (asynchronously).
|
void |
disableSearchCache()
Disable and reset cache
|
void |
enableSearchCache()
Enable search cache with default parameters
|
void |
enableSearchCache(int timeoutInSeconds,
int maxRequests)
Enable search cache with custom parameters
|
Client |
getClient() |
JSONObject |
getObject(String objectID,
Collection<String> attributesToRetrieve,
RequestOptions requestOptions)
Gets an object from this index.
|
JSONObject |
getObject(String objectID,
RequestOptions requestOptions)
Gets an object from this index.
|
Request |
getObjectAsync(String objectID,
Collection<String> attributesToRetrieve,
CompletionHandler completionHandler)
Gets an object from this index, optionally restricting the retrieved content (asynchronously).
|
Request |
getObjectAsync(String objectID,
Collection<String> attributesToRetrieve,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Gets an object from this index, optionally restricting the retrieved content (asynchronously).
|
Request |
getObjectAsync(String objectID,
CompletionHandler completionHandler)
Gets an object from this index (asynchronously).
|
JSONObject |
getObjects(Collection<String> objectIDs)
Gets several objects from this index.
|
JSONObject |
getObjects(Collection<String> objectIDs,
Collection<String> attributesToRetrieve,
RequestOptions requestOptions)
Gets several objects from this index.
|
Request |
getObjectsAsync(Collection<String> objectIDs,
Collection<String> attributesToRetrieve,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Gets several objects from this index (asynchronously), optionally restricting the retrieved content (asynchronously).
|
Request |
getObjectsAsync(Collection<String> objectIDs,
CompletionHandler completionHandler)
Gets several objects from this index (asynchronously).
|
Request |
getObjectsAsync(Collection<String> objectIDs,
List<String> attributesToRetrieve,
CompletionHandler completionHandler)
Gets several objects from this index (asynchronously), optionally restricting the retrieved content (asynchronously).
|
Request |
getObjectsAsync(Collection<String> objectIDs,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Gets several objects from this index (asynchronously), optionally restricting the retrieved content (asynchronously).
|
String |
getRawIndexName() |
JSONObject |
getSettings(int formatVersion,
RequestOptions requestOptions)
Gets the settings of this index for a specific settings format.
|
JSONObject |
getSettings(RequestOptions requestOptions)
Gets the settings of this index.
|
Request |
getSettingsAsync(CompletionHandler completionHandler)
Gets this index's settings (asynchronously).
|
Request |
getSettingsAsync(RequestOptions requestOptions,
CompletionHandler completionHandler)
Gets this index's settings (asynchronously).
|
Request |
multipleQueriesAsync(Collection<Query> queries,
Client.MultipleQueriesStrategy strategy,
CompletionHandler completionHandler)
Run multiple queries on this index with one API call.
|
Request |
multipleQueriesAsync(Collection<Query> queries,
Client.MultipleQueriesStrategy strategy,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Run multiple queries on this index with one API call.
|
JSONObject |
partialUpdateObject(JSONObject partialObject,
String objectID,
Boolean createIfNotExists,
RequestOptions requestOptions)
Update partially an object (only update attributes passed in argument).
|
Request |
partialUpdateObjectAsync(JSONObject partialObject,
String objectID,
boolean createIfNotExists,
CompletionHandler completionHandler)
Partially update an object (asynchronously).
|
Request |
partialUpdateObjectAsync(JSONObject partialObject,
String objectID,
boolean createIfNotExists,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Partially update an object (asynchronously).
|
Request |
partialUpdateObjectAsync(JSONObject partialObject,
String objectID,
CompletionHandler completionHandler)
Partially update an object (asynchronously).
|
JSONObject |
partialUpdateObjects(JSONArray inputArray,
boolean createIfNotExists,
RequestOptions requestOptions)
Partially Override the content of several objects.
|
Request |
partialUpdateObjectsAsync(JSONArray partialObjects,
boolean createIfNotExists,
CompletionHandler completionHandler)
Partially update several objects (asynchronously).
|
Request |
partialUpdateObjectsAsync(JSONArray partialObjects,
boolean createIfNotExists,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Partially update several objects (asynchronously).
|
Request |
partialUpdateObjectsAsync(JSONArray partialObjects,
CompletionHandler completionHandler)
Partially update several objects (asynchronously).
|
JSONObject |
saveObject(JSONObject object,
String objectID,
RequestOptions requestOptions)
Override the content of object.
|
Request |
saveObjectAsync(JSONObject object,
String objectID,
CompletionHandler completionHandler)
Update an object (asynchronously).
|
Request |
saveObjectAsync(JSONObject object,
String objectID,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Update an object (asynchronously).
|
JSONObject |
saveObjects(JSONArray inputArray,
RequestOptions requestOptions)
Override the content of several objects.
|
Request |
saveObjectsAsync(JSONArray objects,
CompletionHandler completionHandler)
Update several objects (asynchronously).
|
Request |
saveObjectsAsync(JSONArray objects,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Update several objects (asynchronously).
|
JSONObject |
search(Query query,
RequestOptions requestOptions)
Searches inside the index.
|
Request |
searchAsync(Query query,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Searches inside this index (asynchronously).
|
Request |
searchDisjunctiveFacetingAsync(Query query,
Collection<String> disjunctiveFacets,
Map<String,? extends Collection<String>> refinements,
CompletionHandler completionHandler)
Perform a search with disjunctive facets, generating as many queries as number of disjunctive facets (helper).
|
Request |
searchDisjunctiveFacetingAsync(Query query,
Collection<String> disjunctiveFacets,
Map<String,? extends Collection<String>> refinements,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Perform a search with disjunctive facets, generating as many queries as number of disjunctive facets (helper).
|
Request |
searchForFacetValues(String facetName,
String text,
CompletionHandler handler)
Deprecated.
Please use
searchForFacetValuesAsync(String, String, CompletionHandler) instead. |
Request |
searchForFacetValues(String facetName,
String facetText,
Query query,
CompletionHandler handler)
Deprecated.
Please use
searchForFacetValuesAsync(String, String, Query, CompletionHandler) instead. |
Request |
searchForFacetValuesAsync(String facetName,
String text,
CompletionHandler handler)
Searches (asynchronously) for some text in a facet values.
|
Request |
searchForFacetValuesAsync(String facetName,
String facetText,
Query query,
CompletionHandler handler)
Searches for some text in a facet values, optionally restricting the returned values to those contained in objects matching other (regular) search criteria.
|
Request |
searchForFacetValuesAsync(String facetName,
String facetText,
Query query,
RequestOptions requestOptions,
CompletionHandler handler)
Searches for some text in a facet values, optionally restricting the returned values to those contained in objects matching other (regular) search criteria.
|
JSONObject |
searchSync(Query query)
Searches inside this index (synchronously).
|
JSONObject |
searchSync(Query query,
RequestOptions requestOptions)
Searches inside this index (synchronously).
|
JSONObject |
setSettings(JSONObject settings,
boolean forwardToReplicas,
RequestOptions requestOptions)
Set settings for this index.
|
Request |
setSettingsAsync(JSONObject settings,
boolean forwardToReplicas,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Set this index's settings (asynchronously).
|
Request |
setSettingsAsync(JSONObject settings,
CompletionHandler completionHandler)
Set this index's settings (asynchronously).
|
String |
toString()
If you override this please be sure it returns a unique string per instance
|
JSONObject |
waitTask(String taskID)
Waits for the publication of a task on the server.
|
JSONObject |
waitTask(String taskID,
long timeToWait)
Wait the publication of a task on the server.
|
Request |
waitTaskAsync(long taskID,
CompletionHandler completionHandler)
Wait until the publication of a task on the server (helper).
|
Request |
waitTaskAsync(String taskID,
CompletionHandler completionHandler)
Wait until the publication of a task on the server (helper).
|
searchAsyncpublic static final int DEFAULT_SETTINGS_VERSION
public String toString()
SearchabletoString in class Searchablepublic String getRawIndexName()
public Client getClient()
public Request searchAsync(@Nullable Query query, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
searchAsync in class Searchablequery - Search parameters. May be null to use an empty query.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public JSONObject searchSync(@Nullable
Query query,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
query - Search parameters.requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject searchSync(@Nullable
Query query)
throws AlgoliaException
AlgoliaExceptionpublic Request multipleQueriesAsync(@NonNull Collection<Query> queries, Client.MultipleQueriesStrategy strategy, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
Client.multipleQueriesAsync(List, Client.MultipleQueriesStrategy, CompletionHandler)
where the targeted index is always the receiver.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 Collection<Query> queries, Client.MultipleQueriesStrategy strategy, @Nullable CompletionHandler completionHandler)
Client.multipleQueriesAsync(List, Client.MultipleQueriesStrategy, CompletionHandler)
where the targeted index is always the receiver.queries - The queries to run.strategy - The strategy to use.completionHandler - The listener that will be notified of the request's outcome.public Request searchDisjunctiveFacetingAsync(@NonNull Query query, @NonNull Collection<String> disjunctiveFacets, @NonNull Map<String,? extends Collection<String>> refinements, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
searchDisjunctiveFacetingAsync in class Searchablequery - The query.disjunctiveFacets - List of disjunctive facets.refinements - The current refinements, mapping facet names to a list of values.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request searchDisjunctiveFacetingAsync(@NonNull Query query, @NonNull Collection<String> disjunctiveFacets, @NonNull Map<String,? extends Collection<String>> refinements, @NonNull CompletionHandler completionHandler)
query - The query.disjunctiveFacets - List of disjunctive facets.refinements - The current refinements, mapping facet names to a list of values.completionHandler - The listener that will be notified of the request's outcome.public Request searchForFacetValuesAsync(@NonNull String facetName, @NonNull String text, @NonNull CompletionHandler handler) throws AlgoliaException
facetName - The name of the facet to search. It must have been declared in the index's `attributesForFaceting` setting with the `searchable()` modifier.text - The text to search for in the facet's values.handler - A Completion handler that will be notified of the request's outcome.AlgoliaExceptionpublic Request searchForFacetValues(@NonNull String facetName, @NonNull String text, @NonNull CompletionHandler handler)
searchForFacetValuesAsync(String, String, CompletionHandler) instead.facetName - The name of the facet to search. It must have been declared in the index's `attributesForFaceting` setting with the `searchable()` modifier.text - The text to search for in the facet's values.handler - A Completion handler that will be notified of the request's outcome.public Request searchForFacetValuesAsync(@NonNull String facetName, @NonNull String facetText, @Nullable Query query, @NonNull CompletionHandler handler)
facetName - The name of the facet to search. It must have been declared in the index's `attributesForFaceting` setting with the `searchable()` modifier.facetText - The text to search for in the facet's values.query - An optional query to take extra search parameters into account. There parameters apply to index objects like in a regular search query. Only facet values contained in the matched objects will be returnedhandler - A Completion handler that will be notified of the request's outcome.public Request searchForFacetValuesAsync(@NonNull String facetName, @NonNull String facetText, @Nullable Query query, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler handler)
searchForFacetValuesAsync in class SearchablefacetName - The name of the facet to search. It must have been declared in the index's `attributesForFaceting` setting with the `searchable()` modifier.facetText - The text to search for in the facet's values.query - An optional query to take extra search parameters into account. There parameters apply to index objects like in a regular search query. Only facet values contained in the matched objects will be returnedrequestOptions - Request-specific options.handler - A Completion handler that will be notified of the request's outcome.public Request searchForFacetValues(@NonNull String facetName, @NonNull String facetText, @Nullable Query query, @NonNull CompletionHandler handler)
searchForFacetValuesAsync(String, String, Query, CompletionHandler) instead.facetName - The name of the facet to search. It must have been declared in the index's `attributesForFaceting` setting with the `searchable()` modifier.facetText - The text to search for in the facet's values.query - An optional query to take extra search parameters into account. There parameters apply to index objects like in a regular search query. Only facet values contained in the matched objects will be returnedhandler - A Completion handler that will be notified of the request's outcome.public Request addObjectAsync(@NonNull JSONObject object, @Nullable CompletionHandler completionHandler)
WARNING: For performance reasons, the arguments are not cloned. Since the method is executed in the background, you should not modify the object after it has been passed.
object - The object to add.completionHandler - The listener that will be notified of the request's outcome.public Request addObjectAsync(@NonNull JSONObject object, @NonNull String objectID, @Nullable CompletionHandler completionHandler)
WARNING: For performance reasons, the arguments are not cloned. Since the method is executed in the background, you should not modify the object after it has been passed.
object - The object to add.objectID - Identifier that you want to assign this object.completionHandler - The listener that will be notified of the request's outcome.public Request addObjectAsync(@NonNull JSONObject object, @NonNull String objectID, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
WARNING: For performance reasons, the arguments are not cloned. Since the method is executed in the background, you should not modify the object after it has been passed.
object - The object to add.objectID - Identifier that you want to assign this object.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request addObjectsAsync(@NonNull JSONArray objects, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
objects - Objects to add.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request addObjectsAsync(@NonNull JSONArray objects, @Nullable CompletionHandler completionHandler)
objects - Objects to add.completionHandler - The listener that will be notified of the request's outcome.public Request saveObjectAsync(@NonNull JSONObject object, @NonNull String objectID, @Nullable CompletionHandler completionHandler)
object - New version of the object to update.objectID - Identifier of the object to update.completionHandler - The listener that will be notified of the request's outcome.public Request saveObjectAsync(@NonNull JSONObject object, @NonNull String objectID, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
object - New version of the object to update.objectID - Identifier of the object to update.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request saveObjectsAsync(@NonNull JSONArray objects, @Nullable CompletionHandler completionHandler)
objects - Objects to update. Each object must contain an objectID attribute.completionHandler - The listener that will be notified of the request's outcome.public Request saveObjectsAsync(@NonNull JSONArray objects, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
objects - Objects to update. Each object must contain an objectID attribute.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request partialUpdateObjectAsync(@NonNull JSONObject partialObject, @NonNull String objectID, @Nullable CompletionHandler completionHandler)
**Note:** This method will create the object if it does not exist already. If you don't wish to, you can use
partialUpdateObjectAsync(JSONObject, String, boolean, CompletionHandler) and specify `false` for the
`createIfNotExists` argument.
partialObject - New value/operations for the object.objectID - Identifier of object to be updated.completionHandler - The listener that will be notified of the request's outcome.public Request partialUpdateObjectAsync(@NonNull JSONObject partialObject, @NonNull String objectID, boolean createIfNotExists, @Nullable CompletionHandler completionHandler)
partialObject - New value/operations for the object.objectID - Identifier of object to be updated.createIfNotExists - Whether the object should be created if it does not exist already.completionHandler - The listener that will be notified of the request's outcome.public Request partialUpdateObjectAsync(@NonNull JSONObject partialObject, @NonNull String objectID, boolean createIfNotExists, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
partialObject - New value/operations for the object.objectID - Identifier of object to be updated.createIfNotExists - Whether the object should be created if it does not exist already.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request partialUpdateObjectsAsync(@NonNull JSONArray partialObjects, @Nullable CompletionHandler completionHandler)
**Note:** This method will create the objects if they do not exist already. If you don't wish to, you can use
partialUpdateObjectsAsync(JSONArray, boolean, CompletionHandler) and specify `false` for the
`createIfNotExists` argument.
partialObjects - New values/operations for the objects. Each object must contain an objectID
attribute.completionHandler - The listener that will be notified of the request's outcome.public Request partialUpdateObjectsAsync(@NonNull JSONArray partialObjects, boolean createIfNotExists, @Nullable CompletionHandler completionHandler)
partialObjects - New values/operations for the objects. Each object must contain an objectID
attribute.createIfNotExists - Whether objects should be created if they do not exist already.completionHandler - The listener that will be notified of the request's outcome.public Request partialUpdateObjectsAsync(@NonNull JSONArray partialObjects, boolean createIfNotExists, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
partialObjects - New values/operations for the objects. Each object must contain an objectID
attribute.createIfNotExists - Whether objects should be created if they do not exist already.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request getObjectAsync(@NonNull String objectID, @Nullable CompletionHandler completionHandler)
objectID - Identifier of the object to retrieve.completionHandler - The listener that will be notified of the request's outcome.public Request getObjectAsync(@NonNull String objectID, Collection<String> attributesToRetrieve, @Nullable CompletionHandler completionHandler)
objectID - Identifier of the object to retrieve.attributesToRetrieve - List of attributes to retrieve.completionHandler - The listener that will be notified of the request's outcome.public Request getObjectAsync(@NonNull String objectID, Collection<String> attributesToRetrieve, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
objectID - Identifier of the object to retrieve.attributesToRetrieve - List of attributes to retrieve.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request getObjectsAsync(@NonNull Collection<String> objectIDs, @Nullable CompletionHandler completionHandler)
objectIDs - Identifiers of objects to retrieve.completionHandler - The listener that will be notified of the request's outcome.public Request getObjectsAsync(@NonNull Collection<String> objectIDs, List<String> attributesToRetrieve, @Nullable CompletionHandler completionHandler)
objectIDs - Identifiers of objects to retrieve.attributesToRetrieve - List of attributes to retrieve.completionHandler - The listener that will be notified of the request's outcome.public Request getObjectsAsync(@NonNull Collection<String> objectIDs, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
objectIDs - Identifiers of objects to retrieve.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request getObjectsAsync(@NonNull Collection<String> objectIDs, Collection<String> attributesToRetrieve, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
objectIDs - Identifiers of objects to retrieve.attributesToRetrieve - List of attributes to retrieve.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request waitTaskAsync(@NonNull String taskID, @Nullable CompletionHandler completionHandler)
taskID - Identifier of the task (as returned by the server).completionHandler - The listener that will be notified of the request's outcome.public Request waitTaskAsync(long taskID, @Nullable CompletionHandler completionHandler)
taskID - Identifier of the task (as returned by the server).completionHandler - The listener that will be notified of the request's outcome.public Request deleteObjectAsync(@NonNull String objectID, @Nullable CompletionHandler completionHandler)
objectID - Identifier of the object to delete.completionHandler - The listener that will be notified of the request's outcome.public Request deleteObjectAsync(@NonNull String objectID, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
objectID - Identifier of the object to delete.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request deleteObjectsAsync(@NonNull Collection<String> objectIDs, @Nullable CompletionHandler completionHandler)
objectIDs - Identifiers of objects to delete.completionHandler - The listener that will be notified of the request's outcome.public Request deleteObjectsAsync(@NonNull Collection<String> objectIDs, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
objectIDs - Identifiers of objects to delete.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request deleteByQueryAsync(@NonNull Query query, @Nullable CompletionHandler completionHandler)
deleteByAsync(Query, CompletionHandler) instead.query - The query that objects to delete must match.completionHandler - The listener that will be notified of the request's outcome.public Request deleteByQueryAsync(@NonNull Query query, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
deleteByAsync(Query, CompletionHandler) instead.query - The query that objects to delete must match.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request deleteByAsync(@NonNull Query query, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
query - The query that objects to delete must match.completionHandler - The listener that will be notified of the request's outcome.public Request deleteByAsync(@NonNull Query query, @Nullable CompletionHandler completionHandler)
query - The query that objects to delete must match.completionHandler - The listener that will be notified of the request's outcome.public Request getSettingsAsync(@Nullable CompletionHandler completionHandler)
completionHandler - The listener that will be notified of the request's outcome.public Request getSettingsAsync(@Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request setSettingsAsync(@NonNull JSONObject settings, @Nullable CompletionHandler completionHandler)
Please refer to our API documentation for the list of supported settings.
settings - New settings.completionHandler - The listener that will be notified of the request's outcome.public Request setSettingsAsync(@NonNull JSONObject settings, boolean forwardToReplicas, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
Please refer to our API documentation for the list of supported settings.
settings - New settings.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request browseAsync(@NonNull Query query, @Nullable CompletionHandler completionHandler)
query - The query parameters for the browse.completionHandler - The listener that will be notified of the request's outcome.public Request browseAsync(@NonNull Query query, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
query - The query parameters for the browse.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request browseFromAsync(@NonNull String cursor, @Nullable CompletionHandler completionHandler)
cursor - The cursor of the next page to retrieve.completionHandler - The listener that will be notified of the request's outcome.public Request browseFromAsync(@NonNull String cursor, @Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
cursor - The cursor of the next page to retrieve.requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public Request clearIndexAsync(@Nullable CompletionHandler completionHandler)
completionHandler - The listener that will be notified of the request's outcome.public Request clearIndexAsync(@Nullable RequestOptions requestOptions, @Nullable CompletionHandler completionHandler)
requestOptions - Request-specific options.completionHandler - The listener that will be notified of the request's outcome.public void enableSearchCache()
public void enableSearchCache(int timeoutInSeconds,
int maxRequests)
timeoutInSeconds - duration during which an request is kept in cachemaxRequests - maximum amount of requests to keep before removing the least recently usedpublic void disableSearchCache()
public void clearSearchCache()
public JSONObject addObject(JSONObject obj,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
obj - the object to add.requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject addObject(JSONObject obj,
String objectID,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
obj - the object to add.objectID - an objectID you want to attribute to this object
(if the attribute already exist the old object will be overwrite)requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject addObjects(JSONArray inputArray,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
inputArray - contains an array of objects to add.requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject getObject(String objectID,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
objectID - the unique identifier of the object to retrieverequestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject getObject(String objectID,
Collection<String> attributesToRetrieve,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
objectID - the unique identifier of the object to retrieveattributesToRetrieve - contains the list of attributes to retrieve.requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject getObjects(Collection<String> objectIDs)
throws AlgoliaException
objectIDs - the array of unique identifier of objects to retrieveAlgoliaExceptionpublic JSONObject getObjects(@NonNull
Collection<String> objectIDs,
@Nullable
Collection<String> attributesToRetrieve,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
objectIDs - the array of unique identifier of objects to retrieveattributesToRetrieve - contains the list of attributes to retrieve.requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject partialUpdateObject(JSONObject partialObject,
String objectID,
Boolean createIfNotExists,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
partialObject - the object attributes to overriderequestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject partialUpdateObjects(JSONArray inputArray,
boolean createIfNotExists,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
inputArray - the array of objects to update (each object must contains an objectID attribute)requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject saveObject(JSONObject object,
String objectID,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
object - the object to saverequestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject saveObjects(JSONArray inputArray,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
inputArray - contains an array of objects to update (each object must contains an objectID attribute)requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject deleteObject(String objectID,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
objectID - the unique identifier of object to deleterequestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject deleteObjects(Collection<String> objects,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
objects - the array of objectIDs to deleterequestOptions - Request-specific options.AlgoliaException@Deprecated
public void deleteByQuery(@NonNull
Query query,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
deleteBy(Query) instead.query - the query stringrequestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject deleteBy(@NonNull
Query query)
throws AlgoliaException
query - the query stringAlgoliaExceptionpublic JSONObject deleteBy(@NonNull
Query query,
RequestOptions requestOptions)
throws AlgoliaException
query - the query stringAlgoliaExceptionpublic JSONObject search(@Nullable
Query query,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject waitTask(String taskID,
long timeToWait)
throws AlgoliaException
taskID - the id of the task returned by servertimeToWait - time to sleep seedAlgoliaExceptionpublic JSONObject waitTask(String taskID)
throws AlgoliaException
taskID - the id of the task returned by serverAlgoliaExceptionpublic JSONObject getSettings(@Nullable
RequestOptions requestOptions)
throws AlgoliaException
requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject getSettings(int formatVersion,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
formatVersion - the version of a settings format.requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject setSettings(JSONObject settings,
boolean forwardToReplicas,
@Nullable
RequestOptions requestOptions)
throws AlgoliaException
settings - the settings object.forwardToReplicas - if true, the new settings will be forwarded to replica indices.requestOptions - Request-specific options.AlgoliaExceptionpublic JSONObject clearIndex(@Nullable
RequestOptions requestOptions)
throws AlgoliaException
requestOptions - Request-specific options.AlgoliaException