I\'m developing Spring Boot + Redis
example. In this example, I\'ve developed some custom methods which pull details based on RoleName. For the below method
On Redis with Spring Boot you just have some queries for finder that are supported like Is, Equals, combine with And, Or , you can take a look on Table 9:
https://docs.spring.io/spring-data/redis/docs/current/reference/html/#redis.repositories.queries
UPDATED
You can create a query following this documentation link as reference
https://docs.spring.io/spring-data/redis/docs/2.1.2.RELEASE/reference/html/#query-by-example
Ok lets start from "How Redis Work"
Redis work on Hashes for ID which helps in faster location of record. @Indexed is also hashed and stored for faster pin-pointing the record
So By Default for MiddleName the "contain" query will not work as Hash for "Test" string will not be contained in Hash for String "TestUser".
But ExampleMatcher is here to the rescue.
Source: https://docs.spring.io/spring-data/redis/docs/2.1.2.RELEASE/reference/html/#query-by-example
Solution for RoleName search on Role Object is relatively simple: Use this query
userRepository.findByRoleRoleName("ADMIN") (Basically remove the underscore)
And good news is that it can be combined with the above ExampleMatcher.
Let's discuss if you have doubt.
Helpfull Reference for RoleName search : Query Nested Objects in Redis using Spring Data