Source:
<code>public long deleteByQuery(Query<K, T> query) throws GoraException { Collection<String> range = runQuery(query); RBatch batchInstance = redisInstance.createBatch(); RLexSortedSetAsync secundaryIndex = batchInstance.getLexSortedSet(generateIndexKey()); if (query.getFields() != null && query.getFields().length < mapping.getFields().size()) { List<String> dbFields = new ArrayList<>(); List<RedisType> dbTypes = new ArrayList<>(); for (String af : query.getFields()) { dbFields.add(mapping.getFields().get(af)); dbTypes.add(mapping.getTypes().get(af)); } for (String key : range) { if (mode == StorageMode.SINGLEKEY) { RMapAsync<Object, Object> map = batchInstance.getMap(generateKeyHash(key)); for (String field : dbFields) { map.removeAsync(field); } } else { for (int i = 0; i < dbFields.size(); i++) { String field = dbFields.get(i); RedisType type = dbTypes.get(i); switch (type) { case STRING: RBucketAsync<Object> bucket = batchInstance.getBucket(generateKeyString(field, key)); bucket.deleteAsync(); break; case LIST: RListAsync<Object> rlist = batchInstance.getList(generateKeyString(field, key)); rlist.deleteAsync(); break; case HASH: RMapAsync<Object, Object> map = batchInstance.getMap(generateKeyString(field, key)); map.deleteAsync(); break; } } } } } else { for (String key : range) { secundaryIndex.removeAsync(key); if (mode == StorageMode.SINGLEKEY) { RMapAsync<Object, Object> map = batchInstance.getMap(generateKeyHash(key)); map.deleteAsync(); } else { <START> redisInstance.getKeys().deleteByPattern(generateKeyStringBase(key) + WILDCARD); <END> } } } batchInstance.execute(); return range.size(); }</code><technical_language>this delete operation is included in batch</technical_language>

Target:
public long deleteByQuery(Query<K, T> query) throws GoraException { Collection<String> range = runQuery(query); RBatch batchInstance = redisInstance.createBatch(); RLexSortedSetAsync secundaryIndex = batchInstance.getLexSortedSet(generateIndexKey()); if (query.getFields() != null && query.getFields().length < mapping.getFields().size()) { List<String> dbFields = new ArrayList<>(); List<RedisType> dbTypes = new ArrayList<>(); for (String af : query.getFields()) { dbFields.add(mapping.getFields().get(af)); dbTypes.add(mapping.getTypes().get(af)); } for (String key : range) { if (mode == StorageMode.SINGLEKEY) { RMapAsync<Object, Object> map = batchInstance.getMap(generateKeyHash(key)); dbFields.forEach((field) -> { map.removeAsync(field); }); } else { for (int i = 0; i < dbFields.size(); i++) { String field = dbFields.get(i); RedisType type = dbTypes.get(i); switch (type) { case STRING: RBucketAsync<Object> bucket = batchInstance.getBucket(generateKeyString(field, key)); bucket.deleteAsync(); break; case LIST: RListAsync<Object> rlist = batchInstance.getList(generateKeyString(field, key)); rlist.deleteAsync(); break; case HASH: RMapAsync<Object, Object> map = batchInstance.getMap(generateKeyString(field, key)); map.deleteAsync(); break; default: throw new AssertionError(type.name()); } } } } } else { range.stream().map((key) -> { secundaryIndex.removeAsync(key); return key; }).forEachOrdered((key) -> { if (mode == StorageMode.SINGLEKEY) { RMapAsync<Object, Object> map = batchInstance.getMap(generateKeyHash(key)); map.deleteAsync(); } else { redisInstance.getKeys().deleteByPattern(generateKeyStringBase(key) + WILDCARD); } }); } batchInstance.execute(); return range.size(); }