Redis Query-by-Example does not support string matcher STARTING, ENDING using Spring data redis

25 Views Asked by At

`We are building an application using JDK17, Spring Data Redis(3.x), spring boot (3.x) which uses AWS Elastic Redis cache (cluster mode enabled), lettuce client by looking at https://docs.spring.io/spring-data/redis/reference/data-commons/query-by-example.html however it ends up with "Redis Query-by-Example does not support string matcher STARTING, Supported matchers are [DEFAULT, EXACT] "

**Code snippet **


public class Person {

@Id
private String id;
private String firstname;
private String lastname;
// … getters and setters omitted
}

**Repository**
public interface PersonRepository extends CrudRepository\<Person, String\>,
QueryByExampleExecutor\<Person\> {}

**Service class**

@Autowired
PersonRepository personRepository;
Person person = new Person();  
person.setFirstname("Dave");  
ExampleMatcher matcher = ExampleMatcher.matching()  
.withIgnorePaths("lastname")  
.withIncludeNullValues()  
.withStringMatcher(StringMatcher.STARTING); // Error is being thrown here  
Example\<Person\> example = Example.of(person, matcher);
personRepository.findAll(example);

Redis Query-by-Example support for StringMatcher STARTING,ENDING, CONTAINING`

0

There are 0 best solutions below