@@ -80,12 +80,7 @@ private Set<IndexedData> doResolveIndexesFor(final String keyspace, final String
80
80
RedisPersistentEntity <?> entity = mappingContext .getPersistentEntity (typeInformation );
81
81
82
82
if (entity == null ) {
83
-
84
- IndexedData index = resolveIndex (keyspace , path , null , value );
85
- if (index != null ) {
86
- return Collections .singleton (index );
87
- }
88
- return Collections .emptySet ();
83
+ return resolveIndex (keyspace , path , null , value );
89
84
}
90
85
91
86
final PersistentPropertyAccessor accessor = entity .getPropertyAccessor (value );
@@ -105,11 +100,7 @@ public void doWithPersistentProperty(KeyValuePersistentProperty persistentProper
105
100
TypeInformation <?> typeHint = persistentProperty .isMap () ? persistentProperty .getTypeInformation ()
106
101
.getMapValueType () : persistentProperty .getTypeInformation ().getActualType ();
107
102
108
- IndexedData index = resolveIndex (keyspace , currentPath , persistentProperty , propertyValue );
109
-
110
- if (index != null ) {
111
- indexes .add (index );
112
- }
103
+ indexes .addAll (resolveIndex (keyspace , currentPath , persistentProperty , propertyValue ));
113
104
114
105
if (persistentProperty .isMap ()) {
115
106
@@ -157,20 +148,22 @@ private TypeInformation<?> updateTypeHintForActualValue(TypeInformation<?> typeH
157
148
return indexes ;
158
149
}
159
150
160
- protected IndexedData resolveIndex (String keyspace , String propertyPath , PersistentProperty <?> property , Object value ) {
151
+ protected Set <IndexedData > resolveIndex (String keyspace , String propertyPath , PersistentProperty <?> property ,
152
+ Object value ) {
161
153
162
154
if (value == null ) {
163
- return null ;
155
+ return Collections . emptySet () ;
164
156
}
165
157
166
158
String path = normalizeIndexPath (propertyPath , property );
167
159
160
+ Set <IndexedData > data = new LinkedHashSet <IndexedData >();
161
+
168
162
if (indexConfiguration .hasIndexFor (keyspace , path )) {
169
- // FIXME it seems there is a mis-match between IndexConfiguration
170
- // resolving many RedisIndexSetting objects to resolving a single
171
- // IndexData in this method.
172
- RedisIndexSetting indexSetting = indexConfiguration .getIndexDefinitionsFor (keyspace , path ).iterator ().next ();
173
- return new SimpleIndexedPropertyValue (keyspace , indexSetting .getIndexName (), value );
163
+ for (RedisIndexSetting indexSetting : indexConfiguration .getIndexDefinitionsFor (keyspace , path )) {
164
+ data .add (new SimpleIndexedPropertyValue (keyspace , indexSetting .getIndexName (), value ));
165
+ }
166
+
174
167
}
175
168
176
169
else if (property != null && property .isAnnotationPresent (Indexed .class )) {
@@ -181,13 +174,14 @@ else if (property != null && property.isAnnotationPresent(Indexed.class)) {
181
174
182
175
switch (indexed .type ()) {
183
176
case SIMPLE :
184
- return new SimpleIndexedPropertyValue (keyspace , path , value );
177
+ data .add (new SimpleIndexedPropertyValue (keyspace , path , value ));
178
+ break ;
185
179
default :
186
180
throw new IllegalArgumentException (String .format ("Unsupported index type '%s' for path '%s'." ,
187
181
indexed .type (), path ));
188
182
}
189
183
}
190
- return null ;
184
+ return data ;
191
185
}
192
186
193
187
private String normalizeIndexPath (String path , PersistentProperty <?> property ) {
0 commit comments