spring-projects / spring-projects/spring-data-redis
Evolve indexing on existing repository data [DATAREDIS-894]
@mp911de is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Sayali opened DATAREDIS-894 and commented
I've below data in Redis and I've Address as model class which has two fields street and city. I've data which has @Indexed on street fields and redis only contains indexed data on street. Now, I want @Indexed to be applied on the data present in the Redis data. How can I do that ?
127.0.0.1:6379> KEYS *
1) "employees:d15be3e8-7662-40bb-ac4e-7b000e6391ec"
2) "employees:d15be3e8-7662-40bb-ac4e-7b000e6391ec:idx"
3) "employees:id:d15be3e8-7662-40bb-ac4e-7b000e6391ec"
4) "employees"
5) "employees:addresses.street:ABC Street"
6) "employees:addresses.street:XYZ Street"
In model class I applied @Indexed on city, now my modelled becomes like
Address.java
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Address {
@Indexed
private String street;
@Indexed
private String city;
}
Employee.java
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@RedisHash("employees")
public class Employee {
@Id @Indexed
private String id;
private String firstName;
private String lastName;
private List<Address> addresses;
}
Now, unless I don't put indexing on redis actual data, List<Employee> findByAddresses_City(String city); doesn't fetches the result.
How can I do that ? I cant wipe out the exsisting data and create new. Any quick help ?
!image-2018-11-22-00-00-45-343.png!
Attachments:
- image-2018-11-22-00-00-45-343.png (275.61 kB)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.