spring-projects/spring-data-redis

is not supported for Redis query derivation

ferhatcamgoz opened this issue · 1 comments

 findAllByCreatedLessThanEqualAndCreatedGreaterThanEqual(Timestamp start, Timestamp end)

When I wrote a query like this, I got an error like this:

java.lang.IllegalArgumentException: LESS_THAN_EQUAL (1): [IsLessThanEqual, LessThanEqual] is not supported for Redis query derivation

I have read articles about support in the documentation:

When I looked at the source code, I found that only 5 types are supported:

org.springframework.data.redis.repository.query.RedisQueryCreator.create(RedisQueryCreator.java:50)

private RedisOperationChain from(Part part, Iterator<Object> iterator, RedisOperationChain sink) {
        switch (part.getType()) {
            case SIMPLE_PROPERTY:
                sink.sismember(part.getProperty().toDotPath(), iterator.next());
                break;
            case TRUE:
                sink.sismember(part.getProperty().toDotPath(), true);
                break;
            case FALSE:
                sink.sismember(part.getProperty().toDotPath(), false);
                break;
            case WITHIN:
            case NEAR:
                sink.near(this.getNearPath(part, iterator));
                break;
            default:
                String message = String.format("%s is not supported for Redis query derivation", part.getType());
                throw new IllegalArgumentException(message);
        }

The referred documentation bits originate from Spring Data's general repository documentation that is used for all Spring Data modules that also calls out to refer to module-specific documentation. You can find the supported query methods at https://docs.spring.io/spring-data/redis/reference/redis/redis-repositories/queries.html.