diff --git a/search_builders.go b/search_builders.go index e9efcf51..95ca3d20 100644 --- a/search_builders.go +++ b/search_builders.go @@ -562,10 +562,10 @@ type DropIndexBuilder struct { // NewDropIndexBuilder creates a new DropIndexBuilder for FT.DROPINDEX commands. // EXPERIMENTAL: this API is subject to change, use with caution. func (c *Client) NewDropIndexBuilder(ctx context.Context, index string) *DropIndexBuilder { - return &DropIndexBuilder{c: c, ctx: ctx, index: index} + return &DropIndexBuilder{c: c, ctx: ctx, index: index, options: &FTDropIndexOptions{}} } -// DeleteRuncs includes DD. +// DeleteDocs includes DD. func (b *DropIndexBuilder) DeleteDocs() *DropIndexBuilder { b.options.DeleteDocs = true; return b } // Run executes FT.DROPINDEX. diff --git a/search_commands_unit_test.go b/search_commands_unit_test.go index e65aa1f1..b128d7c9 100644 --- a/search_commands_unit_test.go +++ b/search_commands_unit_test.go @@ -698,3 +698,13 @@ func TestParseFTHybridWarnings(t *testing.T) { }) } } + +func TestDropIndexBuilderDeleteDocs(t *testing.T) { + client := NewClient(&Options{Addr: "localhost:6379"}) + defer client.Close() + + builder := client.NewDropIndexBuilder(context.Background(), "idx").DeleteDocs() + if builder.options == nil || !builder.options.DeleteDocs { + t.Fatal("expected DeleteDocs to be true") + } +}