-
Notifications
You must be signed in to change notification settings - Fork 101
Description
I have a model like this:
@Data
@Builder
@RequiredArgsConstructor(staticName = "of")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@RedisHash
public class Student {
@Id
private Long id;
@Indexed(alias = "User-Name")
private String userName;
@Indexed(alias = "Event-Timestamp")
private LocalDateTime eventTimestamp;
}
Repository:
@Repository
@Transactional(readOnly = true)
public interface StudentRepository extends RedisEnhancedRepository<Student, Long>, QueryByExampleExecutor<Student> {
List<Student> findByUserNameAndEventTimestampBetweenOrderByEventTimestampAsc(String userName, String fromDate, String toDate);
}
On the start up, index is created like this:
"FT.CREATE" "com.example.demo.entity.StudentIdx" "ON" "HASH" "PREFIX" "1" "com.example.demo.entity.Student:" "SCHEMA" "userName" "AS" "User-Name" "TAG" "SEPARATOR" "|" "eventTimestamp" "AS" "Event-Timestamp" "NUMERIC" "id" "AS" "id" "NUMERIC" "SORTABLE"
Problem 1
When above repository query is invoked, monitor
outputs:
"FT.SEARCH" "com.example.demo.entity.StudentIdx" "@User\\-Name:{pera} @Event\\-Timestamp:[1611995400000 1715851029021]" "SORTBY" "eventTimestamp" "ASC" "LIMIT" "0" "10000"
Exception is:
redis.clients.jedis.exceptions.JedisDataException: Property eventTimestamp not loaded nor in schema
Would it be possible to modify this and make it to be executed as:
"FT.SEARCH" "com.example.demo.entity.StudentIdx" "@User\\-Name:{pera} @Event\\-Timestamp:[1611995400000 1715851029021]" "SORTBY" "Event-Timestamp" "ASC" "LIMIT" "0" "10000"
Note:
I did try:
@Indexed(alias = "Event-Timestamp", fieldName = "Event-Timestamp")
private LocalDateTime eventTimestamp;
Same issue.
Problem 2
Why in the above findBy
query "LIMIT" "0" "10000"` is appended when I didn't specify limit anywhere?
redis:
om:
spring:
repository:
query:
limit: 10000
Why is here limit only 10000?