mirror of https://github.com/go-redis/redis.git
Co-authored-by: andy-stark-redis <164213578+andy-stark-redis@users.noreply.github.com>
This commit is contained in:
parent
ac2e91d9d9
commit
135f8e3b12
|
@ -16,7 +16,7 @@ type SearchCmdable interface {
|
||||||
FTAliasAdd(ctx context.Context, index string, alias string) *StatusCmd
|
FTAliasAdd(ctx context.Context, index string, alias string) *StatusCmd
|
||||||
FTAliasDel(ctx context.Context, alias string) *StatusCmd
|
FTAliasDel(ctx context.Context, alias string) *StatusCmd
|
||||||
FTAliasUpdate(ctx context.Context, index string, alias string) *StatusCmd
|
FTAliasUpdate(ctx context.Context, index string, alias string) *StatusCmd
|
||||||
FTAlter(ctx context.Context, index string, skipInitalScan bool, definition []interface{}) *StatusCmd
|
FTAlter(ctx context.Context, index string, skipInitialScan bool, definition []interface{}) *StatusCmd
|
||||||
FTConfigGet(ctx context.Context, option string) *MapMapStringInterfaceCmd
|
FTConfigGet(ctx context.Context, option string) *MapMapStringInterfaceCmd
|
||||||
FTConfigSet(ctx context.Context, option string, value interface{}) *StatusCmd
|
FTConfigSet(ctx context.Context, option string, value interface{}) *StatusCmd
|
||||||
FTCreate(ctx context.Context, index string, options *FTCreateOptions, schema ...*FieldSchema) *StatusCmd
|
FTCreate(ctx context.Context, index string, options *FTCreateOptions, schema ...*FieldSchema) *StatusCmd
|
||||||
|
@ -57,7 +57,7 @@ type FTCreateOptions struct {
|
||||||
NoFields bool
|
NoFields bool
|
||||||
NoFreqs bool
|
NoFreqs bool
|
||||||
StopWords []interface{}
|
StopWords []interface{}
|
||||||
SkipInitalScan bool
|
SkipInitialScan bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type FieldSchema struct {
|
type FieldSchema struct {
|
||||||
|
@ -70,7 +70,7 @@ type FieldSchema struct {
|
||||||
NoIndex bool
|
NoIndex bool
|
||||||
PhoneticMatcher string
|
PhoneticMatcher string
|
||||||
Weight float64
|
Weight float64
|
||||||
Seperator string
|
Separator string
|
||||||
CaseSensitive bool
|
CaseSensitive bool
|
||||||
WithSuffixtrie bool
|
WithSuffixtrie bool
|
||||||
VectorArgs *FTVectorArgs
|
VectorArgs *FTVectorArgs
|
||||||
|
@ -285,7 +285,7 @@ type FTSearchSortBy struct {
|
||||||
type FTSearchOptions struct {
|
type FTSearchOptions struct {
|
||||||
NoContent bool
|
NoContent bool
|
||||||
Verbatim bool
|
Verbatim bool
|
||||||
NoStopWrods bool
|
NoStopWords bool
|
||||||
WithScores bool
|
WithScores bool
|
||||||
WithPayloads bool
|
WithPayloads bool
|
||||||
WithSortKeys bool
|
WithSortKeys bool
|
||||||
|
@ -808,13 +808,13 @@ func (c cmdable) FTAliasUpdate(ctx context.Context, index string, alias string)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FTAlter - Alters the definition of an existing index.
|
// FTAlter - Alters the definition of an existing index.
|
||||||
// The 'index' parameter specifies the index to alter, and the 'skipInitalScan' parameter specifies whether to skip the initial scan.
|
// The 'index' parameter specifies the index to alter, and the 'skipInitialScan' parameter specifies whether to skip the initial scan.
|
||||||
// The 'definition' parameter specifies the new definition for the index.
|
// The 'definition' parameter specifies the new definition for the index.
|
||||||
// For more information, please refer to the Redis documentation:
|
// For more information, please refer to the Redis documentation:
|
||||||
// [FT.ALTER]: (https://redis.io/commands/ft.alter/)
|
// [FT.ALTER]: (https://redis.io/commands/ft.alter/)
|
||||||
func (c cmdable) FTAlter(ctx context.Context, index string, skipInitalScan bool, definition []interface{}) *StatusCmd {
|
func (c cmdable) FTAlter(ctx context.Context, index string, skipInitialScan bool, definition []interface{}) *StatusCmd {
|
||||||
args := []interface{}{"FT.ALTER", index}
|
args := []interface{}{"FT.ALTER", index}
|
||||||
if skipInitalScan {
|
if skipInitialScan {
|
||||||
args = append(args, "SKIPINITIALSCAN")
|
args = append(args, "SKIPINITIALSCAN")
|
||||||
}
|
}
|
||||||
args = append(args, "SCHEMA", "ADD")
|
args = append(args, "SCHEMA", "ADD")
|
||||||
|
@ -907,7 +907,7 @@ func (c cmdable) FTCreate(ctx context.Context, index string, options *FTCreateOp
|
||||||
args = append(args, "STOPWORDS", len(options.StopWords))
|
args = append(args, "STOPWORDS", len(options.StopWords))
|
||||||
args = append(args, options.StopWords...)
|
args = append(args, options.StopWords...)
|
||||||
}
|
}
|
||||||
if options.SkipInitalScan {
|
if options.SkipInitialScan {
|
||||||
args = append(args, "SKIPINITIALSCAN")
|
args = append(args, "SKIPINITIALSCAN")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1003,8 +1003,8 @@ func (c cmdable) FTCreate(ctx context.Context, index string, options *FTCreateOp
|
||||||
if schema.Weight > 0 {
|
if schema.Weight > 0 {
|
||||||
args = append(args, "WEIGHT", schema.Weight)
|
args = append(args, "WEIGHT", schema.Weight)
|
||||||
}
|
}
|
||||||
if schema.Seperator != "" {
|
if schema.Separator != "" {
|
||||||
args = append(args, "SEPERATOR", schema.Seperator)
|
args = append(args, "SEPARATOR", schema.Separator)
|
||||||
}
|
}
|
||||||
if schema.CaseSensitive {
|
if schema.CaseSensitive {
|
||||||
args = append(args, "CASESENSITIVE")
|
args = append(args, "CASESENSITIVE")
|
||||||
|
@ -1694,7 +1694,7 @@ func FTSearchQuery(query string, options *FTSearchOptions) SearchQuery {
|
||||||
if options.Verbatim {
|
if options.Verbatim {
|
||||||
queryArgs = append(queryArgs, "VERBATIM")
|
queryArgs = append(queryArgs, "VERBATIM")
|
||||||
}
|
}
|
||||||
if options.NoStopWrods {
|
if options.NoStopWords {
|
||||||
queryArgs = append(queryArgs, "NOSTOPWORDS")
|
queryArgs = append(queryArgs, "NOSTOPWORDS")
|
||||||
}
|
}
|
||||||
if options.WithScores {
|
if options.WithScores {
|
||||||
|
@ -1808,7 +1808,7 @@ func (c cmdable) FTSearchWithArgs(ctx context.Context, index string, query strin
|
||||||
if options.Verbatim {
|
if options.Verbatim {
|
||||||
args = append(args, "VERBATIM")
|
args = append(args, "VERBATIM")
|
||||||
}
|
}
|
||||||
if options.NoStopWrods {
|
if options.NoStopWords {
|
||||||
args = append(args, "NOSTOPWORDS")
|
args = append(args, "NOSTOPWORDS")
|
||||||
}
|
}
|
||||||
if options.WithScores {
|
if options.WithScores {
|
||||||
|
|
|
@ -637,11 +637,11 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should FTSearch SkipInitalScan", Label("search", "ftsearch"), func() {
|
It("should FTSearch SkipInitialScan", Label("search", "ftsearch"), func() {
|
||||||
client.HSet(ctx, "doc1", "foo", "bar")
|
client.HSet(ctx, "doc1", "foo", "bar")
|
||||||
|
|
||||||
text1 := &redis.FieldSchema{FieldName: "foo", FieldType: redis.SearchFieldTypeText}
|
text1 := &redis.FieldSchema{FieldName: "foo", FieldType: redis.SearchFieldTypeText}
|
||||||
val, err := client.FTCreate(ctx, "idx1", &redis.FTCreateOptions{SkipInitalScan: true}, text1).Result()
|
val, err := client.FTCreate(ctx, "idx1", &redis.FTCreateOptions{SkipInitialScan: true}, text1).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(val).To(BeEquivalentTo("OK"))
|
Expect(val).To(BeEquivalentTo("OK"))
|
||||||
WaitForIndexing(client, "idx1")
|
WaitForIndexing(client, "idx1")
|
||||||
|
|
Loading…
Reference in New Issue