algoliasearch/src/offline/java/com/algolia/search/saas/OfflineIndex.java
public Request deleteByQueryAsync(@NonNull Query query, CompletionHandler completionHandler) {
        final WriteTransaction transaction = newTransaction();
        final Query queryCopy = new Query(query);
        return getClient().new AsyncTaskRequest(completionHandler, getClient().transactionExecutorService) {
            @NonNull
            @Override
            protected JSONObject run() throws AlgoliaException {
                try {
                    Collection<String> deletedObjectIDs = deleteByQuerySync(queryCopy, transaction);
                    transaction.commitSync();
                    return new JSONObject()
                        .put("objectIDs", new JSONArray(deletedObjectIDs))
                        .put("updatedAt", DateUtils.iso8601String(new Date()))
                        .put("taskID", transaction.id);
                } catch (JSONException e) {
                    throw new RuntimeException(e); // should never happen
                }
            }
        }.start();
    }
public Request deleteByQueryAsync(@NonNull Query query, CompletionHandler completionHandler) {
        final WriteTransaction transaction = newTransaction();
        final Query queryCopy = new Query(query);
        return getClient().new AsyncTaskRequest(completionHandler, getClient().transactionExecutorService) {
            @NonNull
            @Override
            protected JSONObject run() throws AlgoliaException {
                try {
                    Collection<String> deletedObjectIDs = deleteByQuerySync(queryCopy, transaction);
                    transaction.commitSync();
                    return new JSONObject()
                        .put("objectIDs", new JSONArray(deletedObjectIDs))
                        .put("updatedAt", DateUtils.iso8601String(new Date()))
                        .put("taskID", transaction.id);
                } catch (JSONException e) {
                    throw new RuntimeException(e); // should never happen
                }
            }
        }.start();
    }
public Request deleteByQueryAsync ( @ NonNull Query query , CompletionHandler completionHandler ) { final WriteTransaction transaction = newTransaction ( ) ; final Query queryCopy = new Query ( query ) ; return getClient ( ) . new AsyncTaskRequest ( completionHandler , getClient ( ) . transactionExecutorService ) { @ NonNull @ Override protected JSONObject run ( ) throws AlgoliaException { try { Collection < String > deletedObjectIDs = deleteByQuerySync ( queryCopy , transaction ) ; transaction . commitSync ( ) ; return new JSONObject ( ) . put ( "objectIDs" , new JSONArray ( deletedObjectIDs ) ) . put ( "updatedAt" , DateUtils . iso8601String ( new Date ( ) ) ) . put ( "taskID" , transaction . id ) ; } catch ( JSONException e ) { throw new RuntimeException ( e ) ; // should never happen } } } . start ( ) ; }
Delete all objects matching a query (helper).

@param query The query that objects to delete must match.
@param completionHandler The listener that will be notified of the request's outcome.
@return A cancellable request.
Delete all objects matching a query ( helper ) .