public class AsyncIndex<T> extends AbstractIndex
AbstractIndex.Attributes| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<CreateUpdateKey> |
addKey(ApiKey key)
Add a key to this index
|
CompletableFuture<AsyncTaskIndexing> |
addObject(String objectID,
T object)
Add an object in this index with a unique identifier
|
CompletableFuture<AsyncTaskIndexing> |
addObject(T object)
Add an object in this index
|
CompletableFuture<AsyncTaskSingleIndex> |
addObjects(List<T> objects)
Add several objects
|
CompletableFuture<AsyncTaskSingleIndex> |
batch(List<BatchOperation> operations)
Custom batch
|
CompletableFuture<AsyncTask> |
batchSynonyms(List<AbstractSynonym> synonyms)
Add or Replace a list of synonyms, no forward to slaves, and no replacement
|
CompletableFuture<AsyncTask> |
batchSynonyms(List<AbstractSynonym> synonyms,
boolean forwardToReplicas)
Add or Replace a list of synonyms, no replacement
|
CompletableFuture<AsyncTask> |
batchSynonyms(List<AbstractSynonym> synonyms,
boolean forwardToReplicas,
boolean replaceExistingSynonyms)
Add or Replace a list of synonyms
|
CompletableFuture<AsyncTask> |
clear()
Delete the index content without removing settings and index specific API keys.
|
CompletableFuture<AsyncTask> |
clearSynonyms()
Clear all synonyms and NOT forwarding it to the slaves
|
CompletableFuture<AsyncTask> |
clearSynonyms(boolean forwardToReplicas)
Clears all synonyms
|
CompletableFuture<AsyncTask> |
copyTo(String dstIndexName)
Copy an existing index
|
CompletableFuture<AsyncTask> |
delete()
Deletes the index
|
CompletableFuture<DeleteKey> |
deleteKey(String key)
Delete a key by name from this index
|
CompletableFuture<AsyncTask> |
deleteObject(String objectID)
Delete an object from the index
|
CompletableFuture<AsyncTaskSingleIndex> |
deleteObjects(List<String> objectIDs)
Delete objects from the index
|
CompletableFuture<AsyncTask> |
deleteSynonym(String synonymID)
Deletes a synonym by ID and NOT forwarding it to the slaves
|
CompletableFuture<AsyncTask> |
deleteSynonym(String synonymID,
boolean forwardToReplicas)
Deletes a synonym
|
CompletableFuture<Optional<ApiKey>> |
getKey(String key)
Get a key by name from this index
|
Class<T> |
getKlass() |
String |
getName() |
CompletableFuture<Optional<T>> |
getObject(String objectID)
Get an object from this index
|
CompletableFuture<List<T>> |
getObjects(List<String> objectIDs)
Get several objects from this index
|
CompletableFuture<List<T>> |
getObjects(List<String> objectIDs,
List<String> attributesToRetrieve)
Get several objects from this index
|
CompletableFuture<IndexSettings> |
getSettings()
Get settings of this index
|
CompletableFuture<Optional<AbstractSynonym>> |
getSynonym(String synonymID)
Get a synonym by ID
|
CompletableFuture<List<ApiKey>> |
listKeys()
List keys of this index
|
CompletableFuture<AsyncTask> |
moveTo(String dstIndexName)
Moves an existing index
|
CompletableFuture<AsyncTaskSingleIndex> |
partialUpdateObject(PartialUpdateOperation operation)
Partially update an object, create the object if it does not exist
|
CompletableFuture<AsyncTaskSingleIndex> |
partialUpdateObject(PartialUpdateOperation operation,
boolean createIfNotExists)
Partially update an object
|
CompletableFuture<AsyncTaskSingleIndex> |
partialUpdateObject(String objectID,
Object object)
Partially update an object
|
CompletableFuture<AsyncTaskSingleIndex> |
partialUpdateObjects(List<Object> objects)
Partially update a objects
|
CompletableFuture<AsyncTask> |
saveObject(String objectID,
T object)
Override the content of object
|
CompletableFuture<AsyncTaskSingleIndex> |
saveObjects(List<T> objects)
Override the content the list of objects
|
CompletableFuture<AsyncTask> |
saveSynonym(String synonymID,
AbstractSynonym content)
Saves/updates a synonym without replacing it and NOT forwarding it to the slaves
|
CompletableFuture<AsyncTask> |
saveSynonym(String synonymID,
AbstractSynonym content,
boolean forwardToReplicas)
Saves/updates a synonym without replacing
|
CompletableFuture<AsyncTask> |
saveSynonym(String synonymID,
AbstractSynonym content,
boolean forwardToReplicas,
boolean replaceExistingSynonyms)
Saves/updates a synonym
|
CompletableFuture<SearchResult<T>> |
search(Query query)
Search in the index
|
CompletableFuture<SearchSynonymResult> |
searchSynonyms(SynonymQuery query)
Search for synonyms
|
CompletableFuture<AsyncTask> |
setSettings(IndexSettings settings)
Set settings of this index, and do not forward to slaves
|
CompletableFuture<AsyncTask> |
setSettings(IndexSettings settings,
Boolean forwardToReplicas)
Set settings of this index
|
CompletableFuture<CreateUpdateKey> |
updateKey(String keyName,
ApiKey key)
Update a key by name from this index
|
void |
waitTask(AsyncTask task)
Wait for the completion of a task, for 100ms
|
void |
waitTask(AsyncTask task,
long timeToWait)
Wait for the completion of a task
|
public String getName()
getName in class AbstractIndexpublic Class<T> getKlass()
getKlass in class AbstractIndexpublic CompletableFuture<AsyncTaskIndexing> addObject(@Nonnull T object) throws AlgoliaException
object - object to addAlgoliaExceptionpublic CompletableFuture<AsyncTaskIndexing> addObject(@Nonnull String objectID, @Nonnull T object) throws AlgoliaException
objectID - the objectID associated to this object
(if this objectID already exist the old object will be overridden)object - object to addAlgoliaExceptionpublic CompletableFuture<AsyncTaskSingleIndex> addObjects(@Nonnull List<T> objects) throws AlgoliaException
objects - objects to addAlgoliaExceptionpublic CompletableFuture<Optional<T>> getObject(@Nonnull String objectID) throws AlgoliaException
objectID - the unique identifier of the object to retrieveAlgoliaExceptionpublic CompletableFuture<List<T>> getObjects(@Nonnull List<String> objectIDs) throws AlgoliaException
objectIDs - the list of unique identifier of objects to retrieveAlgoliaExceptionpublic CompletableFuture<List<T>> getObjects(@Nonnull List<String> objectIDs, @Nonnull List<String> attributesToRetrieve) throws AlgoliaException
objectIDs - the list of unique identifier of objects to retrieveattributesToRetrieve - the list of attributes to retrieve for these objectsAlgoliaExceptionpublic void waitTask(@Nonnull AsyncTask task, long timeToWait) throws AlgoliaException
task - task to wait fortimeToWait - the time to wait in millisecondsAlgoliaExceptionpublic void waitTask(@Nonnull AsyncTask task) throws AlgoliaException
task - task to wait forAlgoliaExceptionpublic CompletableFuture<AsyncTask> delete() throws AlgoliaException
AlgoliaExceptionpublic CompletableFuture<AsyncTask> clear() throws AlgoliaException
AlgoliaExceptionpublic CompletableFuture<AsyncTask> saveObject(@Nonnull String objectID, @Nonnull T object) throws AlgoliaException
objectID - the unique identifier of the object to retrieveobject - the object to updateAlgoliaExceptionpublic CompletableFuture<AsyncTaskSingleIndex> saveObjects(@Nonnull List<T> objects) throws AlgoliaException
objects - the list objects to updateAlgoliaExceptionpublic CompletableFuture<AsyncTask> deleteObject(@Nonnull String objectID) throws AlgoliaException
objectID - the unique identifier of the object to retrieveAlgoliaExceptionpublic CompletableFuture<AsyncTaskSingleIndex> deleteObjects(@Nonnull List<String> objectIDs) throws AlgoliaException
objectIDs - the list of unique identifier of the object to retrieveAlgoliaExceptionpublic CompletableFuture<IndexSettings> getSettings() throws AlgoliaException
AlgoliaExceptionpublic CompletableFuture<AsyncTask> setSettings(@Nonnull IndexSettings settings) throws AlgoliaException
settings - the settings to setAlgoliaExceptionpublic CompletableFuture<AsyncTask> setSettings(@Nonnull IndexSettings settings, @Nonnull Boolean forwardToReplicas) throws AlgoliaException
settings - the settings to setforwardToReplicas - should these updates be forwarded to the slavesAlgoliaExceptionpublic CompletableFuture<List<ApiKey>> listKeys() throws AlgoliaException
AlgoliaExceptionpublic CompletableFuture<Optional<ApiKey>> getKey(@Nonnull String key) throws AlgoliaException
key - the key nameAlgoliaExceptionpublic CompletableFuture<DeleteKey> deleteKey(@Nonnull String key) throws AlgoliaException
key - the key nameAlgoliaExceptionpublic CompletableFuture<CreateUpdateKey> addKey(@Nonnull ApiKey key) throws AlgoliaException
key - the keyAlgoliaExceptionpublic CompletableFuture<CreateUpdateKey> updateKey(@Nonnull String keyName, @Nonnull ApiKey key) throws AlgoliaException
keyName - the key namekey - the key to updateAlgoliaExceptionpublic CompletableFuture<AsyncTask> moveTo(@Nonnull String dstIndexName) throws AlgoliaException
dstIndexName - the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist)AlgoliaExceptionpublic CompletableFuture<AsyncTask> copyTo(@Nonnull String dstIndexName) throws AlgoliaException
dstIndexName - the new index name that will contains a copy of srcIndexName (destination will be overridden if it already exist)AlgoliaExceptionpublic CompletableFuture<SearchResult<T>> search(@Nonnull Query query) throws AlgoliaException
query - the queryAlgoliaExceptionpublic CompletableFuture<AsyncTaskSingleIndex> batch(@Nonnull List<BatchOperation> operations) throws AlgoliaException
All operations must have index name set to null
operations - the list of operations to perform on this indexAlgoliaException& subclassespublic CompletableFuture<AsyncTaskSingleIndex> partialUpdateObject(@Nonnull String objectID, @Nonnull Object object) throws AlgoliaException
objectID - the ID of object to updateobject - the object to updateAlgoliaException& subclassespublic CompletableFuture<AsyncTaskSingleIndex> partialUpdateObjects(@Nonnull List<Object> objects) throws AlgoliaException
objects - the list of objects to update (with an objectID)AlgoliaExceptionpublic CompletableFuture<AsyncTaskSingleIndex> partialUpdateObject(@Nonnull PartialUpdateOperation operation) throws AlgoliaException
operation - the operation to perform on this objectAlgoliaException& subclassespublic CompletableFuture<AsyncTaskSingleIndex> partialUpdateObject(@Nonnull PartialUpdateOperation operation, boolean createIfNotExists) throws AlgoliaException
operation - the operation to perform on this objectcreateIfNotExists - should the object be created or notAlgoliaException& subclassespublic CompletableFuture<AsyncTask> saveSynonym(@Nonnull String synonymID, @Nonnull AbstractSynonym content) throws AlgoliaException
synonymID - the id of the synonymcontent - the synonymAlgoliaExceptionpublic CompletableFuture<AsyncTask> saveSynonym(@Nonnull String synonymID, @Nonnull AbstractSynonym content, boolean forwardToReplicas) throws AlgoliaException
synonymID - the id of the synonymcontent - the synonymforwardToReplicas - should this request be forwarded to slavesAlgoliaExceptionpublic CompletableFuture<AsyncTask> saveSynonym(@Nonnull String synonymID, @Nonnull AbstractSynonym content, boolean forwardToReplicas, boolean replaceExistingSynonyms) throws AlgoliaException
synonymID - the id of the synonymcontent - the synonymforwardToReplicas - should this request be forwarded to slavesreplaceExistingSynonyms - should replace if this synonyms existsAlgoliaExceptionpublic CompletableFuture<Optional<AbstractSynonym>> getSynonym(@Nonnull String synonymID) throws AlgoliaException
synonymID - the id of the synonymAlgoliaExceptionpublic CompletableFuture<AsyncTask> deleteSynonym(@Nonnull String synonymID) throws AlgoliaException
synonymID - the id of the synonymAlgoliaExceptionpublic CompletableFuture<AsyncTask> deleteSynonym(@Nonnull String synonymID, boolean forwardToReplicas) throws AlgoliaException
synonymID - the id of the synonymforwardToReplicas - should this request be forwarded to slavesAlgoliaExceptionpublic CompletableFuture<AsyncTask> clearSynonyms() throws AlgoliaException
AlgoliaExceptionpublic CompletableFuture<AsyncTask> clearSynonyms(boolean forwardToReplicas) throws AlgoliaException
AlgoliaExceptionpublic CompletableFuture<SearchSynonymResult> searchSynonyms(@Nonnull SynonymQuery query) throws AlgoliaException
query - the queryAlgoliaExceptionpublic CompletableFuture<AsyncTask> batchSynonyms(@Nonnull List<AbstractSynonym> synonyms, boolean forwardToReplicas, boolean replaceExistingSynonyms) throws AlgoliaException
synonyms - List of synonymsforwardToReplicas - Forward the operation to the slave indicesreplaceExistingSynonyms - Replace the existing synonyms with this batchAlgoliaExceptionpublic CompletableFuture<AsyncTask> batchSynonyms(@Nonnull List<AbstractSynonym> synonyms, boolean forwardToReplicas) throws AlgoliaException
synonyms - List of synonymsforwardToReplicas - Forward the operation to the slave indicesAlgoliaExceptionpublic CompletableFuture<AsyncTask> batchSynonyms(@Nonnull List<AbstractSynonym> synonyms) throws AlgoliaException
synonyms - List of synonymsAlgoliaExceptionCopyright © 2016. All rights reserved.