public class Index<T> extends AbstractIndex<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
Index.Attributes |
| Modifier and Type | Method and Description |
|---|---|
CreateUpdateKey |
addKey(ApiKey key)
Add a key to this index
|
TaskIndexing |
addObject(String objectID,
T object)
Add an object in this index with a unique identifier
|
TaskIndexing |
addObject(T object)
Add an object in this index
|
TaskSingleIndex |
addObjects(List<T> objects)
Add several objects
|
TaskSingleIndex |
batch(List<BatchOperation> operations)
Custom batch
|
Task |
batchSynonyms(List<AbstractSynonym> synonyms)
Add or Replace a list of synonyms, no forward to slaves, and no replacement
|
Task |
batchSynonyms(List<AbstractSynonym> synonyms,
boolean forwardToReplicas)
Add or Replace a list of synonyms, no replacement
|
Task |
batchSynonyms(List<AbstractSynonym> synonyms,
boolean forwardToReplicas,
boolean replaceExistingSynonyms)
Add or Replace a list of synonyms
|
IndexIterable<T> |
browse(Query query)
Browse all the content of this index
|
IndexIterable<T> |
browseFrom(Query query,
String cursor)
Browse all the content of this index
|
Task |
clear()
Delete the index content without removing settings and index specific API keys.
|
Task |
clearSynonyms()
Clear all synonyms and NOT forwarding it to the slaves
|
Task |
clearSynonyms(boolean forwardToReplicas)
Clears all synonyms
|
Task |
copyTo(String dstIndexName)
Copy an existing index
|
Task |
delete()
Deletes the index
|
void |
deleteByQuery(Query query)
Delete records matching a query, with a batch size of 1000, internally uses browse
|
void |
deleteByQuery(Query query,
int batchSize)
Delete records matching a query, internally uses browse
|
DeleteKey |
deleteKey(String key)
Delete a key by name from this index
|
Task |
deleteObject(String objectID)
Delete an object from the index
|
TaskSingleIndex |
deleteObjects(List<String> objectIDs)
Delete objects from the index
|
Task |
deleteSynonym(String synonymID)
Deletes a synonym by ID and NOT forwarding it to the slaves
|
Task |
deleteSynonym(String synonymID,
boolean forwardToReplicas)
Deletes a synonym
|
Optional<ApiKey> |
getKey(String key)
Get a key by name from this index
|
Class<T> |
getKlass() |
String |
getName() |
Optional<T> |
getObject(String objectID)
Get an object from this index
|
List<T> |
getObjects(List<String> objectIDs)
Get several objects from this index
|
List<T> |
getObjects(List<String> objectIDs,
List<String> attributesToRetrieve)
Get several objects from this index
|
IndexSettings |
getSettings()
Get settings of this index
|
Optional<AbstractSynonym> |
getSynonym(String synonymID)
Get a synonym by ID
|
List<ApiKey> |
listKeys()
List keys of this index
|
Task |
moveTo(String dstIndexName)
Moves an existing index
|
TaskSingleIndex |
partialUpdateObject(PartialUpdateOperation operation)
Partially update an object, create the object if it does not exist
|
TaskSingleIndex |
partialUpdateObject(PartialUpdateOperation operation,
boolean createIfNotExists)
Partially update an object
|
TaskSingleIndex |
partialUpdateObject(String objectID,
Object object)
Partially update an object
|
TaskSingleIndex |
partialUpdateObjects(List<Object> objects)
Partially update a objects
|
Task |
saveObject(String objectID,
T object)
Override the content of object
|
TaskSingleIndex |
saveObjects(List<T> objects)
Override the content the list of objects
|
Task |
saveSynonym(String synonymID,
AbstractSynonym content)
Saves/updates a synonym without replacing it and NOT forwarding it to the slaves
|
Task |
saveSynonym(String synonymID,
AbstractSynonym content,
boolean forwardToReplicas)
Saves/updates a synonym without replacing
|
Task |
saveSynonym(String synonymID,
AbstractSynonym content,
boolean forwardToReplicas,
boolean replaceExistingSynonyms)
Saves/updates a synonym
|
SearchResult<T> |
search(Query query)
Search in the index
throws a
AlgoliaIndexNotFoundException if the index does not exists |
SearchSynonymResult |
searchSynonyms(SynonymQuery query)
Search for synonyms
|
Task |
setSettings(IndexSettings settings)
Set settings of this index, and do not forward to slaves
|
Task |
setSettings(IndexSettings settings,
Boolean forwardToReplicas)
Set settings of this index
|
CreateUpdateKey |
updateKey(String keyName,
ApiKey key)
Update a key by name from this index
|
void |
waitTask(Task task)
Wait for the completion of a task, for 100ms
|
void |
waitTask(Task task,
long timeToWait)
Wait for the completion of a task
|
public String getName()
getName in class AbstractIndex<T>public Class<T> getKlass()
getKlass in class AbstractIndex<T>public TaskIndexing addObject(@Nonnull T object) throws AlgoliaException
object - object to addAlgoliaExceptionpublic TaskIndexing 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 TaskSingleIndex addObjects(@Nonnull List<T> objects) throws AlgoliaException
objects - objects to addAlgoliaExceptionpublic Optional<T> getObject(@Nonnull String objectID) throws AlgoliaException
objectID - the unique identifier of the object to retrieveAlgoliaExceptionpublic List<T> getObjects(@Nonnull List<String> objectIDs) throws AlgoliaException
objectIDs - the list of unique identifier of objects to retrieveAlgoliaExceptionpublic 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 Task task, long timeToWait) throws AlgoliaException
task - task to wait fortimeToWait - the time to wait in millisecondsAlgoliaExceptionpublic void waitTask(@Nonnull Task task) throws AlgoliaException
task - task to wait forAlgoliaExceptionpublic Task delete() throws AlgoliaException
AlgoliaExceptionpublic Task clear() throws AlgoliaException
AlgoliaExceptionpublic Task saveObject(@Nonnull String objectID, @Nonnull T object) throws AlgoliaException
objectID - the unique identifier of the object to retrieveobject - the object to updateAlgoliaExceptionpublic TaskSingleIndex saveObjects(@Nonnull List<T> objects) throws AlgoliaException
objects - the list objects to updateAlgoliaExceptionpublic Task deleteObject(@Nonnull String objectID) throws AlgoliaException
objectID - the unique identifier of the object to retrieveAlgoliaExceptionpublic TaskSingleIndex deleteObjects(@Nonnull List<String> objectIDs) throws AlgoliaException
objectIDs - the list of unique identifier of the object to retrieveAlgoliaExceptionpublic IndexSettings getSettings() throws AlgoliaException
AlgoliaExceptionpublic Task setSettings(@Nonnull IndexSettings settings) throws AlgoliaException
settings - the settings to setAlgoliaExceptionpublic Task setSettings(@Nonnull IndexSettings settings, @Nonnull Boolean forwardToReplicas) throws AlgoliaException
settings - the settings to setforwardToReplicas - should these updates be forwarded to the slavesAlgoliaExceptionpublic List<ApiKey> listKeys() throws AlgoliaException
AlgoliaExceptionpublic Optional<ApiKey> getKey(@Nonnull String key) throws AlgoliaException
key - the key nameAlgoliaExceptionpublic DeleteKey deleteKey(@Nonnull String key) throws AlgoliaException
key - the key nameAlgoliaExceptionpublic CreateUpdateKey addKey(@Nonnull ApiKey key) throws AlgoliaException
key - the keyAlgoliaExceptionpublic CreateUpdateKey updateKey(@Nonnull String keyName, @Nonnull ApiKey key) throws AlgoliaException
keyName - the key namekey - the key to updateAlgoliaExceptionpublic Task 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 Task 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 SearchResult<T> search(@Nonnull Query query) throws AlgoliaException
AlgoliaIndexNotFoundException if the index does not existsquery - the queryAlgoliaExceptionpublic TaskSingleIndex 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 TaskSingleIndex partialUpdateObject(@Nonnull String objectID, @Nonnull Object object) throws AlgoliaException
objectID - the ID of object to updateobject - the object to updateAlgoliaException& subclassespublic TaskSingleIndex partialUpdateObjects(@Nonnull List<Object> objects) throws AlgoliaException
objects - the list of objects to update (with an objectID)AlgoliaExceptionpublic TaskSingleIndex partialUpdateObject(@Nonnull PartialUpdateOperation operation) throws AlgoliaException
operation - the operation to perform on this objectAlgoliaException& subclassespublic TaskSingleIndex partialUpdateObject(@Nonnull PartialUpdateOperation operation, boolean createIfNotExists) throws AlgoliaException
operation - the operation to perform on this objectcreateIfNotExists - should the object be created or notAlgoliaException& subclassespublic Task saveSynonym(@Nonnull String synonymID, @Nonnull AbstractSynonym content) throws AlgoliaException
synonymID - the id of the synonymcontent - the synonymAlgoliaExceptionpublic Task 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 Task 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 Optional<AbstractSynonym> getSynonym(@Nonnull String synonymID) throws AlgoliaException
synonymID - the id of the synonymAlgoliaExceptionpublic Task deleteSynonym(@Nonnull String synonymID) throws AlgoliaException
synonymID - the id of the synonymAlgoliaExceptionpublic Task deleteSynonym(@Nonnull String synonymID, boolean forwardToReplicas) throws AlgoliaException
synonymID - the id of the synonymforwardToReplicas - should this request be forwarded to slavesAlgoliaExceptionpublic Task clearSynonyms() throws AlgoliaException
AlgoliaExceptionpublic Task clearSynonyms(boolean forwardToReplicas) throws AlgoliaException
AlgoliaExceptionpublic SearchSynonymResult searchSynonyms(@Nonnull SynonymQuery query) throws AlgoliaException
query - the queryAlgoliaExceptionpublic Task 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 Task batchSynonyms(@Nonnull List<AbstractSynonym> synonyms, boolean forwardToReplicas) throws AlgoliaException
synonyms - List of synonymsforwardToReplicas - Forward the operation to the slave indicesAlgoliaExceptionpublic Task batchSynonyms(@Nonnull List<AbstractSynonym> synonyms) throws AlgoliaException
synonyms - List of synonymsAlgoliaExceptionpublic IndexIterable<T> browse(@Nonnull Query query) throws AlgoliaException
query - The query to use to browseAlgoliaExceptionpublic IndexIterable<T> browseFrom(@Nonnull Query query, @Nullable String cursor) throws AlgoliaException
query - The query to use to browsecursor - the cursor to start fromAlgoliaExceptionpublic void deleteByQuery(@Nonnull Query query) throws AlgoliaException
query - The queryAlgoliaExceptionpublic void deleteByQuery(@Nonnull Query query, int batchSize) throws AlgoliaException
query - The querybatchSize - the size of the batchesAlgoliaExceptionCopyright © 2016. All rights reserved.