Skip to content
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

Wrong LOAD fields parsing in the FT.AGGREGATE and FT.SEARCH commands for JSON data #3989

Closed
BagritsevichStepan opened this issue Oct 24, 2024 · 0 comments · Fixed by #4012
Closed
Assignees
Labels
bug Something isn't working Next Up task that is ready to be worked on and should be added to working queue

Comments

@BagritsevichStepan
Copy link
Contributor

Describe the bug
We need to correctly parse the fields specified in the LOAD option for JSON data. This can be an alias or the full path to the field (JsonPath Legacy mode is not supported).

For example,

Initialize:

127.0.0.1:6379> json.set j1 . '{"value":1}'
OK
127.0.0.1:6379> ft.create index on json schema $.value as value numeric sortable
OK

Here $.value is path and 'value' is alias.

Redis:

127.0.0.1:6379> ft.aggregate index "*" LOAD 1 @value // Alias
1) (integer) 1
2) 1) "value"
   2) "1"
127.0.0.1:6379> ft.aggregate index "*" LOAD 1 value // Alias
1) (integer) 1
2) 1) "value"
   2) "1"
127.0.0.1:6379> ft.aggregate index "*" LOAD 1 $.value // JsonPath
1) (integer) 1
2) 1) "$.value"
   2) "1"
127.0.0.1:6379> ft.aggregate index "*" LOAD 1 .value // JsonPath legacy mode
1) (integer) 1
2) (empty array)

Dragonfly:

127.0.0.1:6379> ft.aggregate index "*" LOAD 1 @value
1) (integer) 1
2) 1) "$.value" // Wrong, we should return alias
   2) "1"
127.0.0.1:6379> ft.aggregate index "*" LOAD 1 value
1) (integer) 1
2) 1) "$.value" // Wrong, we should return alias
   2) "1"
127.0.0.1:6379> ft.aggregate index "*" LOAD 1 $.value
1) (integer) 1
2) 1) "$.value"
   2) "1"
127.0.0.1:6379> ft.aggregate index "*" LOAD 1 .value
1) (integer) 1
2) 1) "$.value" // Wrong
   2) "1"
@BagritsevichStepan BagritsevichStepan added the bug Something isn't working label Oct 24, 2024
@BagritsevichStepan BagritsevichStepan self-assigned this Oct 24, 2024
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Oct 29, 2024
@adiholden adiholden added the Next Up task that is ready to be worked on and should be added to working queue label Oct 29, 2024
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Oct 30, 2024
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Oct 30, 2024
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 3, 2024
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 18, 2024
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 19, 2024
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 20, 2024
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 25, 2024
BagritsevichStepan added a commit that referenced this issue Nov 25, 2024
…T.SEARCH commands (#4012)

* fix(search_family): Fix LOAD fields parsing in the FT.AGGREGATE and FT.SEARCH commands

fixes #3989

Signed-off-by: Stsiapan Bahrytsevich <[email protected]>

* refactor: address comments

Signed-off-by: Stepan Bagritsevich <[email protected]>

* refactor(search_family): Address comments 2

Signed-off-by: Stepan Bagritsevich <[email protected]>

* refactor(search_family): address comments 3

Signed-off-by: Stepan Bagritsevich <[email protected]>

* refactor(search_family): address comments 4

Signed-off-by: Stepan Bagritsevich <[email protected]>

* refactor(search_family): address comments 5

Signed-off-by: Stepan Bagritsevich <[email protected]>

---------

Signed-off-by: Stsiapan Bahrytsevich <[email protected]>
Signed-off-by: Stepan Bagritsevich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Next Up task that is ready to be worked on and should be added to working queue
Projects
None yet
2 participants