-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QueryByExample<T> with RedisEnhancedRepository<T, ID> #439
Comments
@dasivon021 can you copy and paste the ticket description form the Spring Data Redis repo here? |
done. |
@dasivon021 see the current correct usage here now:
|
Hi @bsbodden, I just tested with 0.9.2-SNAPSHOT and property (alias name) is properly escaped But it does not escape values with special characters. If in the initial post, you use this line:
The query which is issued is:
Two questions:
|
Hi @bsbodden and @sazzad16,
When I'm trying to execute query using
QueryByExampleExecutor<T>
interface special characters are not escaped which causes query to fail. Reproducible example is hereContext:
I'm using Spring Boot 3.2.3 and redis-om-spring (0.9.1). redis-om-spring transitively uses spring-data-redis. The model looks like this:
Hash records are stored in this format:
My application will only be executing search queries.
On the application 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"
Repository:
If I try to invoke
findFirstByPropertyOrderByEventTimestamp
, I get an exception:By looking at the queries on
monitor
, I can see this is actually executed:"FT.SEARCH" "com.example.demo.entity.StudentIdx" "( @User-Name:{pera})" "SORTBY" "Event-Timestamp" "DESC" "LIMIT" "0" "1" "DIALECT" "1"
What in fact should be executed is:
"FT.SEARCH" "com.example.demo.entity.StudentIdx" "( @User\\-Name:{pera})" "SORTBY" "Event-Timestamp" "DESC" "LIMIT" "0" "1" "DIALECT" "1"
This is the code which invokes the query:
This same problem was present in redis-om-spring lib, but with 433 it was quickly resolved.
Hopefully, similar changes are can be done here.
The text was updated successfully, but these errors were encountered: