I am using redis-om-spring:1.0.4 with spring boot 3.4.10 for getting @Document support.
I have some class like
@Setter
@Getter
class Vehicle {
@Id
private String id;
@Searchable
private String model;
@Reference
@Indexed
private Owner owner;
}
@Setter
@Getter
class Owner{
@Id
private String id;
@Searchable
private String name;
}
There are generated metamodel classes: Vehicle$ and Owner$.
I tried to filter document by using Entity Stream Search:
@Service
class SomeService{
@Autowired
private EntitySearch entitysearch;
public List<Vehicle> findBy(String model, String name) {
try (var search = entitysearch.of(Vehicle.class)) {
if (!ObjectUtils.isEmpty(model)) {
search.filter(Vehicle$.MODEL.eq(model));
}
if (!ObjectUtils.isEmpty(name)) {
search.filter(Vehicle$.OWNER.NAME.eq(name)); // Here the problem
}
return stream.collection(Collectors.toList());
}
}
}
The problem that Vehicle$.OWNER is ReferenceField type and has only eq(Owner owner) method. And code like this Employee$.DEPARTMENT.eq(somePredicate) from the Redis OM Spring doesn't compile
Structure of ReferenceField class
I've seen that in old version 0.8.0 we can access to field like this Vehicle$.OWNER_NAME.eq(). But in 1.0.4 it doesn't generate some value
I don't want create fake Owner instances. What if we has collection of values and want to find any document that contains in the set, Vehicle$.OWNER.NAME.in(someCollection)
-
1Thank you for reporting this issue. I was able to reproduce it and I created an issue on GitHub. You can follow it on github.com/redis/redis-om-spring/issues/677Raphael De Lio– Raphael De Lio2025年10月24日 05:50:43 +00:00Commented 19 hours ago