@@ -122,6 +122,7 @@ public void doWithPersistentProperty(RedisPersistentProperty persistentProperty)
122122 Object propertyValue = accessor .getProperty (persistentProperty );
123123
124124 if (propertyValue == null ) {
125+ indexes .addAll (resolveIndex (keyspace , currentPath , persistentProperty , null ));
125126 return ;
126127 }
127128
@@ -212,21 +213,32 @@ protected Set<IndexedData> resolveIndex(String keyspace, String propertyPath,
212213
213214 IndexedData indexedData = null ;
214215 if (transformedValue == null ) {
215- indexedData = new RemoveIndexedData (indexedData );
216+
217+ indexedData = new RemoveIndexedData (new IndexedData () {
218+ @ Override
219+ public String getIndexName () {
220+ return indexDefinition .getIndexName ();
221+ }
222+
223+ @ Override
224+ public String getKeyspace () {
225+ return indexDefinition .getKeyspace ();
226+ }
227+ });
216228 } else {
217229 indexedData = indexedDataFactoryProvider .getIndexedDataFactory (indexDefinition ).createIndexedDataFor (value );
218230 }
219231 data .add (indexedData );
220232 }
221233 }
222234
223- else if (property != null && property .isAnnotationPresent (Indexed .class )) {
235+ else if (property != null && value != null && property .isAnnotationPresent (Indexed .class )) {
224236
225237 SimpleIndexDefinition indexDefinition = new SimpleIndexDefinition (keyspace , path );
226238 indexConfiguration .addIndexDefinition (indexDefinition );
227239
228240 data .add (indexedDataFactoryProvider .getIndexedDataFactory (indexDefinition ).createIndexedDataFor (value ));
229- } else if (property != null && property .isAnnotationPresent (GeoIndexed .class )) {
241+ } else if (property != null && value != null && property .isAnnotationPresent (GeoIndexed .class )) {
230242
231243 GeoIndexDefinition indexDefinition = new GeoIndexDefinition (keyspace , path );
232244 indexConfiguration .addIndexDefinition (indexDefinition );
0 commit comments