spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

Refactor IndexWriter implementation

Open junghoon-vans opened this issue 1 year ago • 0 comments

Currently, the creation of secandary indexes and index helpers within IndexWriter is difficult to read at a glance. So I'm going to rewrite the code in a declarative style by isolating the methods for creating these indexes.

Secondary Index

AS-IS

Set<byte[]> existingKeys = connection
    .keys(toBytes(indexedData.getKeyspace() + ":" + indexedData.getIndexName() + ":*"));

TO-BE

Set<byte[]> existingKeys = connection.keys(createIndexKey(indexedData, "*"));

Index Helper

AS-IS

byte[] indexHelperKey = ByteUtils.concatAll(toBytes(keyspace + ":"), binKey, toBytes(":idx"));

TO-BE

byte[] indexHelperKey = createIndexHelperKey(keyspace, binKey);

junghoon-vans avatar Dec 01 '23 08:12 junghoon-vans