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 field types in indexes #3986

Closed
BagritsevichStepan opened this issue Oct 24, 2024 · 0 comments · Fixed by #4070
Closed

Wrong field types in indexes #3986

BagritsevichStepan opened this issue Oct 24, 2024 · 0 comments · Fixed by #4070
Assignees
Labels
bug Something isn't working

Comments

@BagritsevichStepan
Copy link
Contributor

Describe the bug
If the field type in the document and in the index differ, we should not return this document in FT.SEARCH or FT.AGGREGATE.

For example:
Initialize:

127.0.0.1:6379> HSET h1 even true value one
(integer) 2
127.0.0.1:6379> HSET h2 even false value 1
(integer) 2
127.0.0.1:6379> FT.CREATE i1 on HASH SCHEMA value NUMERIC SORTABLE
OK

Redis:

127.0.0.1:6379> FT.SEARCH i1 "*"
1) (integer) 1
2) "h2"
3) 1) "even"
   2) "false"
   3) "value"
   4) "1"

Dragonfly:

127.0.0.1:6379> FT.SEARCH i1 "*"
1) (integer) 2
2) "h2"
3) 1) "value"
   2) "1"
   3) "even"
   4) "false"
4) "h1" // Wrong. We should not return this document
5) 1) "value"
   2) "0"
   3) "even"
   4) "true"

At the same time, if the field is missing in the document, we should return this document. For example:

Redis:

127.0.0.1:6379> HSET h1 even true
(integer) 1
127.0.0.1:6379> HSET h2 even false value 1
(integer) 2
127.0.0.1:6379> FT.CREATE i1 on HASH SCHEMA value NUMERIC SORTABLE
OK
127.0.0.1:6379> FT.SEARCH i1 "*"
1) (integer) 2
2) "h2"
3) 1) "even"
   2) "false"
   3) "value"
   4) "1"
4) "h1"
5) 1) "even"
   2) "true"
@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 24, 2024
…EARCH and FT.AGGREGATE commands

fixes dragonflydb#3986

Signed-off-by: Stsiapan Bahrytsevich <[email protected]>
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 5, 2024
…EARCH and FT.AGGREGATE commands

fixes dragonflydb#3986

Signed-off-by: Stepan Bagritsevich <[email protected]>
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 5, 2024
…EARCH and FT.AGGREGATE commands

fixes dragonflydb#3986

Signed-off-by: Stepan Bagritsevich <[email protected]>
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 6, 2024
…EARCH and FT.AGGREGATE commands

fixes dragonflydb#3986

Signed-off-by: Stepan Bagritsevich <[email protected]>
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 8, 2024
…EARCH and FT.AGGREGATE commands

fixes dragonflydb#3986

Signed-off-by: Stepan Bagritsevich <[email protected]>
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 9, 2024
…EARCH and FT.AGGREGATE commands

fixes dragonflydb#3986

Signed-off-by: Stepan Bagritsevich <[email protected]>
BagritsevichStepan added a commit to BagritsevichStepan/dragonfly that referenced this issue Nov 10, 2024
…EARCH and FT.AGGREGATE commands

fixes dragonflydb#3986

Signed-off-by: Stepan Bagritsevich <[email protected]>
romange pushed a commit that referenced this issue Nov 10, 2024
…EARCH and FT.AGGREGATE commands (#4070)

* fix(search_family): Process wrong field types in indexes for the FT.SEARCH and FT.AGGREGATE commands

fixes  #3986
---------

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