Description
Document class -
@Data
@RequiredArgsConstructor(staticName = "of")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Document(value = "cmpny:")
@IndexingOptions(indexName = "idx:company", creationMode = IndexCreationMode.DROP_AND_RECREATE)
class Company {
@Id
private String id;
@Indexed(schemaFieldType = SchemaFieldType.TAG, sortable = true)
private Set<String> tags = new HashSet<String>();
/**
* It does not creates the index on nested fields within Phones class.
*/
@Indexed(schemaFieldType = SchemaFieldType.NESTED, sortable = false)
private List<Phones> phonesList;
// Below one works for nested fields within address.
@Indexed(schemaFieldType = SchemaFieldType.NESTED, sortable = false)
private Address address;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Phones {
@Indexed(schemaFieldType = SchemaFieldType.TAG, sortable = true)
private String number;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Address {
@Indexed(schemaFieldType = SchemaFieldType.TAG, sortable = true)
private String city;
}
Upon executing with @EnableRedisDocumentRepositories(basePackages = "com.ecs.sgws.poc.romsdocuments.model")
, it generates index for all fields except for List of Phones.
Below is the index info snapshot using FT.INFO idx:company
Expectation was to also get $.phonesList[*].number
indexed but it did not get indexed. Right now we are defining schema in explicit manner (no declarative).
redis-om-spring version : 0.9.5
- Followed reference document : https://redis.io/learn/develop/java/spring/redis-om/redis-om-spring-json
Please kindly add support for indexing json array kind of elements in declarative manner.
PS : Since json array is not supported in declarative manner, we also have a hunch that search result serialization might not also work with it, as see a similar code logic for projection fields - https://github.com/redis/redis-om-spring/blob/main/redis-om-spring/src/main/java/com/redis/om/spring/search/stream/SearchStreamImpl.java#L558