Interface DocumentOperations

All Known Subinterfaces:
MeilisearchOperations
All Known Implementing Classes:
MeilisearchTemplate

public interface DocumentOperations
The operations for the Documents API.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    delete(Class<?> clazz, List<String> documentIds)
    Deletes all entities of the given type with the given document ids.
    boolean
    delete(String documentId, Class<?> clazz)
    Deletes the entity with the given document id.
    <T> boolean
    delete(List<T> entities)
    Deletes the given entities.
    <T> boolean
    delete(T entity)
    Deletes a given entity.
    boolean
    deleteAll(Class<?> clazz)
    Deletes all entities of the given type.
    boolean
    exists(String documentId, Class<?> clazz)
    Checks whether an entity with the given document id exists.
    <T> T
    get(String documentId, Class<T> clazz)
    Retrieves an entity by its document id.
    <T> List<T>
    multiGet(Class<T> clazz)
    Retrieves all entities of the given type.
    <T> List<T>
    multiGet(Class<T> clazz, int offset, int limit)
    Retrieves all entities of the given type with the given offset and limit.
    <T> List<T>
    multiGet(Class<T> clazz, List<String> documentIds)
    Retrieves all entities of the given type with the given document ids.
    <T> List<T>
    multiGet(Class<T> clazz, List<String> documentIds, int offset, int limit)
    Retrieves all entities of the given type with the given document ids and offset and limit.
    <T> List<T>
    save(List<T> entities)
    Saves all given entities.
    <T> T
    save(T entity)
    Saves an entity.
  • Method Details

    • save

      <T> T save(T entity)
      Saves an entity.
      Type Parameters:
      T - the type of the entity
      Parameters:
      entity - the entity to save
      Returns:
      the saved entity
    • save

      <T> List<T> save(List<T> entities)
      Saves all given entities.
      Type Parameters:
      T - the type of the entity
      Parameters:
      entities - the entities to save
      Returns:
      the saved entities as list
    • get

      @Nullable <T> T get(String documentId, Class<T> clazz)
      Retrieves an entity by its document id.
      Type Parameters:
      T - the type of the entity
      Parameters:
      documentId - the document id of the entity
      clazz - the entity class, must be annotated with Document
      Returns:
      the entity with the given document id or null if none found
    • multiGet

      <T> List<T> multiGet(Class<T> clazz)
      Retrieves all entities of the given type.
      Type Parameters:
      T - the type of the entity
      Parameters:
      clazz - the entity class, must be annotated with Document
      Returns:
      all entities
    • multiGet

      <T> List<T> multiGet(Class<T> clazz, int offset, int limit)
      Retrieves all entities of the given type with the given offset and limit.
      Type Parameters:
      T - entity type
      Parameters:
      clazz - must not be null.
      offset - must not be null.
      limit - must not be null.
      Returns:
      entities
    • multiGet

      <T> List<T> multiGet(Class<T> clazz, List<String> documentIds)
      Retrieves all entities of the given type with the given document ids.
      Type Parameters:
      T - the type of the entity
      Parameters:
      documentIds - the document ids of the entities
      clazz - the entity class, must be annotated with Document
      Returns:
      all entities with the given document ids
    • multiGet

      <T> List<T> multiGet(Class<T> clazz, List<String> documentIds, int offset, int limit)
      Retrieves all entities of the given type with the given document ids and offset and limit.
      Type Parameters:
      T - entity type
      Parameters:
      clazz - must not be null.
      documentIds - must not be null.
      offset - must not be null.
      limit - must not be null.
      Returns:
      entities
    • exists

      boolean exists(String documentId, Class<?> clazz)
      Checks whether an entity with the given document id exists.
      Parameters:
      documentId - the document id of the entity
      clazz - the entity class, must be annotated with Document
      Returns:
      true if an entity with the given document id exists
    • delete

      boolean delete(String documentId, Class<?> clazz)
      Deletes the entity with the given document id.
      Parameters:
      documentId - the document id of the entity
      clazz - the entity class, must be annotated with Document
      Returns:
      true if an entity was deleted
    • delete

      <T> boolean delete(T entity)
      Deletes a given entity.
      Type Parameters:
      T - the type of the entity
      Parameters:
      entity - the entity to delete
      Returns:
      true if an entity was deleted
    • delete

      boolean delete(Class<?> clazz, List<String> documentIds)
      Deletes all entities of the given type with the given document ids.
      Parameters:
      clazz - the entity class, must be annotated with Document
      documentIds - the document ids of the entities
      Returns:
      true if all entities were deleted
    • delete

      <T> boolean delete(List<T> entities)
      Deletes the given entities.
      Type Parameters:
      T - the type of the entity
      Parameters:
      entities - the entities to delete
      Returns:
      true if all entities were deleted
    • deleteAll

      boolean deleteAll(Class<?> clazz)
      Deletes all entities of the given type.
      Parameters:
      clazz - the entity class, must be annotated with Document
      Returns:
      true if all entities were deleted