mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Enable dialect 2 on default (#3213)
* Enable dialect 2 on deafult * add vector test for default dialect * Add dialect 1 test * Add dialect 1 test & fix ft.search * Add default dialect to Readme
This commit is contained in:
@ -604,6 +604,8 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
|
||||
|
||||
if options.DialectVersion > 0 {
|
||||
queryArgs = append(queryArgs, "DIALECT", options.DialectVersion)
|
||||
} else {
|
||||
queryArgs = append(queryArgs, "DIALECT", 2)
|
||||
}
|
||||
}
|
||||
return queryArgs
|
||||
@ -801,6 +803,8 @@ func (c cmdable) FTAggregateWithArgs(ctx context.Context, index string, query st
|
||||
}
|
||||
if options.DialectVersion > 0 {
|
||||
args = append(args, "DIALECT", options.DialectVersion)
|
||||
} else {
|
||||
args = append(args, "DIALECT", 2)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1174,6 +1178,8 @@ func (c cmdable) FTExplainWithArgs(ctx context.Context, index string, query stri
|
||||
args := []interface{}{"FT.EXPLAIN", index, query}
|
||||
if options.Dialect != "" {
|
||||
args = append(args, "DIALECT", options.Dialect)
|
||||
} else {
|
||||
args = append(args, "DIALECT", 2)
|
||||
}
|
||||
cmd := NewStringCmd(ctx, args...)
|
||||
_ = c(ctx, cmd)
|
||||
@ -1471,6 +1477,8 @@ func (c cmdable) FTSpellCheckWithArgs(ctx context.Context, index string, query s
|
||||
}
|
||||
if options.Dialect > 0 {
|
||||
args = append(args, "DIALECT", options.Dialect)
|
||||
} else {
|
||||
args = append(args, "DIALECT", 2)
|
||||
}
|
||||
}
|
||||
cmd := newFTSpellCheckCmd(ctx, args...)
|
||||
@ -1840,6 +1848,8 @@ func FTSearchQuery(query string, options *FTSearchOptions) SearchQuery {
|
||||
}
|
||||
if options.DialectVersion > 0 {
|
||||
queryArgs = append(queryArgs, "DIALECT", options.DialectVersion)
|
||||
} else {
|
||||
queryArgs = append(queryArgs, "DIALECT", 2)
|
||||
}
|
||||
}
|
||||
return queryArgs
|
||||
@ -1955,6 +1965,8 @@ func (c cmdable) FTSearchWithArgs(ctx context.Context, index string, query strin
|
||||
}
|
||||
if options.DialectVersion > 0 {
|
||||
args = append(args, "DIALECT", options.DialectVersion)
|
||||
} else {
|
||||
args = append(args, "DIALECT", 2)
|
||||
}
|
||||
}
|
||||
cmd := newFTSearchCmd(ctx, options, args...)
|
||||
|
Reference in New Issue
Block a user