-1

Am unable to filter on Date fields with Redis-search eg: entityStream.of(Object.class), at the same time, being able to filter other data types but not with Date type

tried with the below patterns but not working

SearchStream search = entityStream.of(Person.class);

search.filter(Person$.DOB.onOrAfter(dob)); //yyyy-MM-dd HH:mm:ss

Model can be seen in attached [1]: https://i.stack.imgur.com/GUmTb.png

1 Answers1

0

The issue is that to be able to index the Date, they need to be stored as a numeric value in Redis (to use the search engine NUMERIC schema field). So the two Json annotations:

@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)

Are preventing the built-in Serializers in Redis OM from storing this as numbers. To prevent that from happening you could remove those and let the Redis OM serializers deal with it.

BSB
  • 1,516
  • 13
  • 14
  • I have tested by removing these annotations as well, it's not working. i have also tried the date field with a Long type. – baddi lingamurthy May 09 '23 at 18:25
  • baddi join us at http://discord.gg/redis and I can help you directly. In the meantime accept the answer above and I'll see you on Discord – BSB May 10 '23 at 19:27