1
0
mirror of https://github.com/redis/go-redis.git synced 2025-09-04 09:22:10 +03:00

VSIM add EPSILON option (#3454)

Signed-off-by: Xiaolong Chen <fukua95@gmail.com>
This commit is contained in:
cxljs
2025-07-31 16:45:39 +08:00
committed by ofekshenawa
parent e6ea0056fe
commit 74a798736f

View File

@@ -287,8 +287,7 @@ type VSimArgs struct {
FilterEF int64 FilterEF int64
Truth bool Truth bool
NoThread bool NoThread bool
// The `VSim` command in Redis has the option, by the doc in Redis.io don't have. Epsilon float64
// Epsilon float64
} }
func (v VSimArgs) appendArgs(args []any) []any { func (v VSimArgs) appendArgs(args []any) []any {
@@ -310,13 +309,13 @@ func (v VSimArgs) appendArgs(args []any) []any {
if v.NoThread { if v.NoThread {
args = append(args, "nothread") args = append(args, "nothread")
} }
// if v.Epsilon > 0 { if v.Epsilon > 0 {
// args = append(args, "Epsilon", v.Epsilon) args = append(args, "Epsilon", v.Epsilon)
// } }
return args return args
} }
// `VSIM key (ELE | FP32 | VALUES num) (vector | element) [COUNT num] // `VSIM key (ELE | FP32 | VALUES num) (vector | element) [COUNT num] [EPSILON delta]
// [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` // [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]`
// note: the API is experimental and may be subject to change. // note: the API is experimental and may be subject to change.
func (c cmdable) VSimWithArgs(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *StringSliceCmd { func (c cmdable) VSimWithArgs(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *StringSliceCmd {
@@ -331,7 +330,7 @@ func (c cmdable) VSimWithArgs(ctx context.Context, key string, val Vector, simAr
return cmd return cmd
} }
// `VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [COUNT num] // `VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [COUNT num] [EPSILON delta]
// [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]` // [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]`
// note: the API is experimental and may be subject to change. // note: the API is experimental and may be subject to change.
func (c cmdable) VSimWithArgsWithScores(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *VectorScoreSliceCmd { func (c cmdable) VSimWithArgsWithScores(ctx context.Context, key string, val Vector, simArgs *VSimArgs) *VectorScoreSliceCmd {