1
0
mirror of https://github.com/redis/go-redis.git synced 2025-09-05 20:24:00 +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
Truth 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 {
@@ -310,13 +309,13 @@ func (v VSimArgs) appendArgs(args []any) []any {
if v.NoThread {
args = append(args, "nothread")
}
// if v.Epsilon > 0 {
// args = append(args, "Epsilon", v.Epsilon)
// }
if v.Epsilon > 0 {
args = append(args, "Epsilon", v.Epsilon)
}
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]`
// 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 {
@@ -331,7 +330,7 @@ func (c cmdable) VSimWithArgs(ctx context.Context, key string, val Vector, simAr
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]`
// 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 {