I have provided an example program that doesn't panic when the command run on the database should return an error.
The resulting pointer is nil and error is empty causing no panic.
result: 0x0
package main
import (
"context"
"strings"
"github.com/redis/go-redis/v9"
)
func createIndexAndLoadData(client *redis.Client, ctx context.Context) {
if _, err := client.FTCreate(ctx,
"temp",
&redis.FTCreateOptions{Prefix: []interface{}{"user:"}},
&redis.FieldSchema{FieldName: "__key", FieldType: redis.SearchFieldTypeText},
).Result(); err != nil && !strings.Contains(err.Error(), "Index already exists") {
panic(err)
}
if _, err := client.HSet(ctx, "user:1", []string{"__key", "v1"}).Result(); err != nil {
panic(err)
}
}
func runAggregateQuery(client *redis.Client, ctx context.Context) {
filterOpts := &redis.FTAggregateOptions{
Load: []redis.FTAggregateLoad{
{
Field: "@__key",
As: "key",
},
},
}
result, err := client.FTAggregateWithArgs(ctx, "temp", "*", filterOpts).Result()
if err != nil {
panic(err)
}
println("result:", result)
}
func main() {
ctx := context.Background()
client := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Protocol: 2,
})
createIndexAndLoadData(client, ctx)
runAggregateQuery(client, ctx)
}
Attempting to recreate a separate issue. The database is OSS 6.2.7.
I have provided an example program that doesn't panic when the command run on the database should return an error.
Expected Behavior
Panic with error message
(error) Unknown argumentASat position 4 for <main>Current Behavior
The resulting pointer is nil and error is empty causing no panic.
result: 0x0Steps to Reproduce
Removing the
Asfield fixes the issue and a proper response is returned.Context (Environment)
Attempting to recreate a separate issue. The database is OSS 6.2.7.