diff --git a/internal/server/token.go b/internal/server/token.go index 6b471b0c..72b70e8a 100644 --- a/internal/server/token.go +++ b/internal/server/token.go @@ -359,7 +359,7 @@ func (s *Server) parseSearchScanBaseTokens( err = errInvalidArgument(valStr) return } - valArr = append(valArr, val) + valArr[i] = val } t.whereins = append(t.whereins, whereinT{field, -1, valArr}) continue diff --git a/tests/keys_test.go b/tests/keys_test.go index 17ad6e51..0170ca27 100644 --- a/tests/keys_test.go +++ b/tests/keys_test.go @@ -394,6 +394,9 @@ func keys_WHEREIN_test(mc *mockServer) error { {"SET", "mykey", "myid_a2", "FIELD", "a", 2, "POINT", 32.99, -115}, {"OK"}, {"SET", "mykey", "myid_a3", "FIELD", "a", 3, "POINT", 33, -115.02}, {"OK"}, {"WITHIN", "mykey", "WHEREIN", "a", 3, 0, 1, 2, "BOUNDS", 32.8, -115.2, 33.2, -114.8}, {`[0 [[myid_a1 {"type":"Point","coordinates":[-115,33]} [a 1]] [myid_a2 {"type":"Point","coordinates":[-115,32.99]} [a 2]]]]`}, + // zero value should not match 1 and 2 + {"SET", "mykey", "myid_a0", "FIELD", "a", 0, "POINT", 33, -115.02}, {"OK"}, + {"WITHIN", "mykey", "WHEREIN", "a", 2, 1, 2, "BOUNDS", 32.8, -115.2, 33.2, -114.8}, {`[0 [[myid_a1 {"type":"Point","coordinates":[-115,33]} [a 1]] [myid_a2 {"type":"Point","coordinates":[-115,32.99]} [a 2]]]]`}, }) }