package redis

import (
	
	
)

// ----------------------
// Search Module Builders
// ----------------------

// SearchBuilder provides a fluent API for FT.SEARCH
// (see original FTSearchOptions for all options).
// EXPERIMENTAL: this API is subject to change, use with caution.
type SearchBuilder struct {
	c       *Client
	ctx     context.Context
	index   string
	query   string
	options *FTSearchOptions
}

// NewSearchBuilder creates a new SearchBuilder for FT.SEARCH commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context, ,  string) *SearchBuilder {
	 := &SearchBuilder{c: , ctx: , index: , query: , options: &FTSearchOptions{LimitOffset: -1}}
	return 
}

// WithScores includes WITHSCORES.
func ( *SearchBuilder) () *SearchBuilder {
	.options.WithScores = true
	return 
}

// NoContent includes NOCONTENT.
func ( *SearchBuilder) () *SearchBuilder { .options.NoContent = true; return  }

// Verbatim includes VERBATIM.
func ( *SearchBuilder) () *SearchBuilder { .options.Verbatim = true; return  }

// NoStopWords includes NOSTOPWORDS.
func ( *SearchBuilder) () *SearchBuilder { .options.NoStopWords = true; return  }

// WithPayloads includes WITHPAYLOADS.
func ( *SearchBuilder) () *SearchBuilder {
	.options.WithPayloads = true
	return 
}

// WithSortKeys includes WITHSORTKEYS.
func ( *SearchBuilder) () *SearchBuilder {
	.options.WithSortKeys = true
	return 
}

// Filter adds a FILTER clause: FILTER <field> <min> <max>.
func ( *SearchBuilder) ( string, ,  interface{}) *SearchBuilder {
	.options.Filters = append(.options.Filters, FTSearchFilter{
		FieldName: ,
		Min:       ,
		Max:       ,
	})
	return 
}

// GeoFilter adds a GEOFILTER clause: GEOFILTER <field> <lon> <lat> <radius> <unit>.
func ( *SearchBuilder) ( string, , ,  float64,  string) *SearchBuilder {
	.options.GeoFilter = append(.options.GeoFilter, FTSearchGeoFilter{
		FieldName: ,
		Longitude: ,
		Latitude:  ,
		Radius:    ,
		Unit:      ,
	})
	return 
}

// InKeys restricts the search to the given keys.
func ( *SearchBuilder) ( ...interface{}) *SearchBuilder {
	.options.InKeys = append(.options.InKeys, ...)
	return 
}

// InFields restricts the search to the given fields.
func ( *SearchBuilder) ( ...interface{}) *SearchBuilder {
	.options.InFields = append(.options.InFields, ...)
	return 
}

// ReturnFields adds simple RETURN <n> <field>...
func ( *SearchBuilder) ( ...string) *SearchBuilder {
	for ,  := range  {
		.options.Return = append(.options.Return, FTSearchReturn{FieldName: })
	}
	return 
}

// ReturnAs adds RETURN <field> AS <alias>.
func ( *SearchBuilder) (,  string) *SearchBuilder {
	.options.Return = append(.options.Return, FTSearchReturn{FieldName: , As: })
	return 
}

// Slop adds SLOP <n>.
func ( *SearchBuilder) ( int) *SearchBuilder {
	.options.Slop = 
	return 
}

// Timeout adds TIMEOUT <ms>.
func ( *SearchBuilder) ( int) *SearchBuilder {
	.options.Timeout = 
	return 
}

// InOrder includes INORDER.
func ( *SearchBuilder) () *SearchBuilder {
	.options.InOrder = true
	return 
}

// Language sets LANGUAGE <lang>.
func ( *SearchBuilder) ( string) *SearchBuilder {
	.options.Language = 
	return 
}

// Expander sets EXPANDER <expander>.
func ( *SearchBuilder) ( string) *SearchBuilder {
	.options.Expander = 
	return 
}

// Scorer sets SCORER <scorer>.
func ( *SearchBuilder) ( string) *SearchBuilder {
	.options.Scorer = 
	return 
}

// ExplainScore includes EXPLAINSCORE.
func ( *SearchBuilder) () *SearchBuilder {
	.options.ExplainScore = true
	return 
}

// Payload sets PAYLOAD <payload>.
func ( *SearchBuilder) ( string) *SearchBuilder {
	.options.Payload = 
	return 
}

// SortBy adds SORTBY <field> ASC|DESC.
func ( *SearchBuilder) ( string,  bool) *SearchBuilder {
	.options.SortBy = append(.options.SortBy, FTSearchSortBy{
		FieldName: ,
		Asc:       ,
		Desc:      !,
	})
	return 
}

// WithSortByCount includes WITHCOUNT (when used with SortBy).
func ( *SearchBuilder) () *SearchBuilder {
	.options.SortByWithCount = true
	return 
}

// Param adds a single PARAMS <k> <v>.
func ( *SearchBuilder) ( string,  interface{}) *SearchBuilder {
	if .options.Params == nil {
		.options.Params = make(map[string]interface{}, 1)
	}
	.options.Params[] = 
	return 
}

// ParamsMap adds multiple PARAMS at once.
func ( *SearchBuilder) ( map[string]interface{}) *SearchBuilder {
	if .options.Params == nil {
		.options.Params = make(map[string]interface{}, len())
	}
	for ,  := range  {
		.options.Params[] = 
	}
	return 
}

// Dialect sets DIALECT <version>.
func ( *SearchBuilder) ( int) *SearchBuilder {
	.options.DialectVersion = 
	return 
}

// Limit sets OFFSET and COUNT. CountOnly uses LIMIT 0 0.
func ( *SearchBuilder) (,  int) *SearchBuilder {
	.options.LimitOffset = 
	.options.Limit = 
	return 
}
func ( *SearchBuilder) () *SearchBuilder { .options.CountOnly = true; return  }

// Run executes FT.SEARCH and returns a typed result.
func ( *SearchBuilder) () (FTSearchResult, error) {
	 := .c.FTSearchWithArgs(.ctx, .index, .query, .options)
	return .Result()
}

// ----------------------
// AggregateBuilder for FT.AGGREGATE
// ----------------------

type AggregateBuilder struct {
	c       *Client
	ctx     context.Context
	index   string
	query   string
	options *FTAggregateOptions
	err     error
}

// NewAggregateBuilder creates a new AggregateBuilder for FT.AGGREGATE commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context, ,  string) *AggregateBuilder {
	return &AggregateBuilder{c: , ctx: , index: , query: , options: &FTAggregateOptions{LimitOffset: -1}}
}

// setErr records the first error produced while building the pipeline.
// Subsequent errors are ignored; the first error is returned from Run.
func ( *AggregateBuilder) ( error) {
	if .err == nil {
		.err = 
	}
}

// Verbatim includes VERBATIM.
func ( *AggregateBuilder) () *AggregateBuilder { .options.Verbatim = true; return  }

// AddScores includes ADDSCORES.
func ( *AggregateBuilder) () *AggregateBuilder { .options.AddScores = true; return  }

// Scorer sets SCORER <scorer>.
func ( *AggregateBuilder) ( string) *AggregateBuilder {
	.options.Scorer = 
	return 
}

// LoadAll includes LOAD * (mutually exclusive with Load).
func ( *AggregateBuilder) () *AggregateBuilder {
	.options.LoadAll = true
	return 
}

// Load adds a LOAD <field> [AS alias] step.
// You can call it multiple times; each call becomes a separate LOAD clause
// at its position in the pipeline.
func ( *AggregateBuilder) ( string,  ...string) *AggregateBuilder {
	 := &FTAggregateLoad{Field: }
	if len() > 0 {
		.As = [0]
	}
	.options.Steps = append(.options.Steps, FTAggregateStep{Load: })
	return 
}

// Timeout sets TIMEOUT <ms>.
func ( *AggregateBuilder) ( int) *AggregateBuilder {
	.options.Timeout = 
	return 
}

// Apply adds an APPLY <field> [AS alias] step.
func ( *AggregateBuilder) ( string,  ...string) *AggregateBuilder {
	 := &FTAggregateApply{Field: }
	if len() > 0 {
		.As = [0]
	}
	.options.Steps = append(.options.Steps, FTAggregateStep{Apply: })
	return 
}

// GroupBy adds a new GROUPBY <fields...> step.
func ( *AggregateBuilder) ( ...interface{}) *AggregateBuilder {
	.options.Steps = append(.options.Steps, FTAggregateStep{
		GroupBy: &FTAggregateGroupBy{Fields: },
	})
	return 
}

// Reduce adds a REDUCE <fn> [<#args> <args...>] clause to the last step,
// which must be a GROUPBY. If it is not, Run will return an error.
func ( *AggregateBuilder) ( SearchAggregator,  ...interface{}) *AggregateBuilder {
	 := len(.options.Steps)
	if  == 0 || .options.Steps[-1].GroupBy == nil {
		.setErr(fmt.Errorf("FT.AGGREGATE: Reduce must follow a GroupBy step"))
		return 
	}
	 := .options.Steps[-1].GroupBy
	.Reduce = append(.Reduce, FTAggregateReducer{Reducer: , Args: })
	return 
}

// ReduceAs does the same but also sets an alias: REDUCE <fn> … AS <alias>.
// The last step must be a GROUPBY; otherwise Run will return an error.
func ( *AggregateBuilder) ( SearchAggregator,  string,  ...interface{}) *AggregateBuilder {
	 := len(.options.Steps)
	if  == 0 || .options.Steps[-1].GroupBy == nil {
		.setErr(fmt.Errorf("FT.AGGREGATE: ReduceAs must follow a GroupBy step"))
		return 
	}
	 := .options.Steps[-1].GroupBy
	.Reduce = append(.Reduce, FTAggregateReducer{Reducer: , Args: , As: })
	return 
}

// Collect adds a REDUCE COLLECT clause to the last step, which must be a
// GROUPBY. The COLLECT options (FIELDS/DISTINCT/SORTBY/LIMIT/AS) are rendered
// and the argument count is computed automatically; field and sort names are
// normalized to a single "@" prefix. Set FTAggregateCollect.As to alias the
// output column.
//
// If the last step is not a GROUPBY, or the options are invalid (no FIELDS
// selector), Run returns the recorded error without issuing the command.
// COLLECT requires Redis 8.8+ with unstable features enabled.
func ( *AggregateBuilder) ( FTAggregateCollect) *AggregateBuilder {
	 := len(.options.Steps)
	if  == 0 || .options.Steps[-1].GroupBy == nil {
		.setErr(fmt.Errorf("FT.AGGREGATE: Collect must follow a GroupBy step"))
		return 
	}
	,  := NewCollectReducer()
	if  != nil {
		.setErr()
		return 
	}
	 := .options.Steps[-1].GroupBy
	.Reduce = append(.Reduce, )
	return 
}

// SortBy adds SORTBY <field> ASC|DESC. Consecutive SortBy calls (with no
// other step in between) are merged into a single SORTBY clause so fields
// act as tiebreakers. A SortBy call after a non-SortBy step starts a new
// SORTBY step.
//
// Note: this is a semantics change from earlier experimental versions of
// the builder, where SortBy always accumulated into a single SORTBY clause
// regardless of position in the pipeline.
func ( *AggregateBuilder) ( string,  bool) *AggregateBuilder {
	 := FTAggregateSortBy{FieldName: , Asc: , Desc: !}
	if  := len(.options.Steps);  > 0 && .options.Steps[-1].SortBy != nil {
		.options.Steps[-1].SortBy.Fields = append(.options.Steps[-1].SortBy.Fields, )
		return 
	}
	.options.Steps = append(.options.Steps, FTAggregateStep{
		SortBy: &FTAggregateSortByStep{Fields: []FTAggregateSortBy{}},
	})
	return 
}

// SortByMax sets MAX <n> on the last SORTBY step. The last step must be a
// SORTBY; otherwise Run will return an error.
func ( *AggregateBuilder) ( int) *AggregateBuilder {
	 := len(.options.Steps)
	if  == 0 || .options.Steps[-1].SortBy == nil {
		.setErr(fmt.Errorf("FT.AGGREGATE: SortByMax must follow a SortBy step"))
		return 
	}
	.options.Steps[-1].SortBy.Max = 
	return 
}

// Filter sets FILTER <expr>.
func ( *AggregateBuilder) ( string) *AggregateBuilder {
	.options.Filter = 
	return 
}

// WithCursor enables WITHCURSOR [COUNT <n>] [MAXIDLE <ms>].
func ( *AggregateBuilder) (,  int) *AggregateBuilder {
	.options.WithCursor = true
	if .options.WithCursorOptions == nil {
		.options.WithCursorOptions = &FTAggregateWithCursor{}
	}
	.options.WithCursorOptions.Count = 
	.options.WithCursorOptions.MaxIdle = 
	return 
}

// Params adds PARAMS <k v> pairs.
func ( *AggregateBuilder) ( map[string]interface{}) *AggregateBuilder {
	if .options.Params == nil {
		.options.Params = make(map[string]interface{}, len())
	}
	for ,  := range  {
		.options.Params[] = 
	}
	return 
}

// Dialect sets DIALECT <version>.
func ( *AggregateBuilder) ( int) *AggregateBuilder {
	.options.DialectVersion = 
	return 
}

// Run executes FT.AGGREGATE and returns a typed result. If the builder
// recorded a validation error while constructing the pipeline (for example,
// calling SortByMax when the last step is not a SortBy), that error is
// returned without issuing the command.
func ( *AggregateBuilder) () (*FTAggregateResult, error) {
	if .err != nil {
		return nil, .err
	}
	 := .c.FTAggregateWithArgs(.ctx, .index, .query, .options)
	return .Result()
}

// ----------------------
// CreateIndexBuilder for FT.CREATE
// ----------------------
// CreateIndexBuilder is builder for FT.CREATE
// EXPERIMENTAL: this API is subject to change, use with caution.
type CreateIndexBuilder struct {
	c       *Client
	ctx     context.Context
	index   string
	options *FTCreateOptions
	schema  []*FieldSchema
}

// NewCreateIndexBuilder creates a new CreateIndexBuilder for FT.CREATE commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context,  string) *CreateIndexBuilder {
	return &CreateIndexBuilder{c: , ctx: , index: , options: &FTCreateOptions{}}
}

// OnHash sets ON HASH.
func ( *CreateIndexBuilder) () *CreateIndexBuilder { .options.OnHash = true; return  }

// OnJSON sets ON JSON.
func ( *CreateIndexBuilder) () *CreateIndexBuilder { .options.OnJSON = true; return  }

// Prefix sets PREFIX.
func ( *CreateIndexBuilder) ( ...interface{}) *CreateIndexBuilder {
	.options.Prefix = 
	return 
}

// Filter sets FILTER.
func ( *CreateIndexBuilder) ( string) *CreateIndexBuilder {
	.options.Filter = 
	return 
}

// DefaultLanguage sets LANGUAGE.
func ( *CreateIndexBuilder) ( string) *CreateIndexBuilder {
	.options.DefaultLanguage = 
	return 
}

// LanguageField sets LANGUAGE_FIELD.
func ( *CreateIndexBuilder) ( string) *CreateIndexBuilder {
	.options.LanguageField = 
	return 
}

// Score sets SCORE.
func ( *CreateIndexBuilder) ( float64) *CreateIndexBuilder {
	.options.Score = 
	return 
}

// ScoreField sets SCORE_FIELD.
func ( *CreateIndexBuilder) ( string) *CreateIndexBuilder {
	.options.ScoreField = 
	return 
}

// PayloadField sets PAYLOAD_FIELD.
func ( *CreateIndexBuilder) ( string) *CreateIndexBuilder {
	.options.PayloadField = 
	return 
}

// NoOffsets includes NOOFFSETS.
func ( *CreateIndexBuilder) () *CreateIndexBuilder { .options.NoOffsets = true; return  }

// Temporary sets TEMPORARY seconds.
func ( *CreateIndexBuilder) ( int) *CreateIndexBuilder {
	.options.Temporary = 
	return 
}

// NoHL includes NOHL.
func ( *CreateIndexBuilder) () *CreateIndexBuilder { .options.NoHL = true; return  }

// NoFields includes NOFIELDS.
func ( *CreateIndexBuilder) () *CreateIndexBuilder { .options.NoFields = true; return  }

// NoFreqs includes NOFREQS.
func ( *CreateIndexBuilder) () *CreateIndexBuilder { .options.NoFreqs = true; return  }

// StopWords sets STOPWORDS.
func ( *CreateIndexBuilder) ( ...interface{}) *CreateIndexBuilder {
	.options.StopWords = 
	return 
}

// SkipInitialScan includes SKIPINITIALSCAN.
func ( *CreateIndexBuilder) () *CreateIndexBuilder {
	.options.SkipInitialScan = true
	return 
}

// Schema adds a FieldSchema.
func ( *CreateIndexBuilder) ( *FieldSchema) *CreateIndexBuilder {
	.schema = append(.schema, )
	return 
}

// Run executes FT.CREATE and returns the status.
func ( *CreateIndexBuilder) () (string, error) {
	 := .c.FTCreate(.ctx, .index, .options, .schema...)
	return .Result()
}

// ----------------------
// DropIndexBuilder for FT.DROPINDEX
// ----------------------
// DropIndexBuilder is a builder for FT.DROPINDEX
// EXPERIMENTAL: this API is subject to change, use with caution.
type DropIndexBuilder struct {
	c       *Client
	ctx     context.Context
	index   string
	options *FTDropIndexOptions
}

// NewDropIndexBuilder creates a new DropIndexBuilder for FT.DROPINDEX commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context,  string) *DropIndexBuilder {
	return &DropIndexBuilder{c: , ctx: , index: }
}

// DeleteRuncs includes DD.
func ( *DropIndexBuilder) () *DropIndexBuilder { .options.DeleteDocs = true; return  }

// Run executes FT.DROPINDEX.
func ( *DropIndexBuilder) () (string, error) {
	 := .c.FTDropIndexWithArgs(.ctx, .index, .options)
	return .Result()
}

// ----------------------
// AliasBuilder for FT.ALIAS* commands
// ----------------------
// AliasBuilder is builder for FT.ALIAS* commands
// EXPERIMENTAL: this API is subject to change, use with caution.
type AliasBuilder struct {
	c      *Client
	ctx    context.Context
	alias  string
	index  string
	action string // add|del|update
}

// NewAliasBuilder creates a new AliasBuilder for FT.ALIAS* commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context,  string) *AliasBuilder {
	return &AliasBuilder{c: , ctx: , alias: }
}

// Action sets the action for the alias builder.
func ( *AliasBuilder) ( string) *AliasBuilder {
	.action = 
	return 
}

// Add sets the action to "add" and requires an index.
func ( *AliasBuilder) ( string) *AliasBuilder {
	.action = "add"
	.index = 
	return 
}

// Del sets the action to "del".
func ( *AliasBuilder) () *AliasBuilder {
	.action = "del"
	return 
}

// Update sets the action to "update" and requires an index.
func ( *AliasBuilder) ( string) *AliasBuilder {
	.action = "update"
	.index = 
	return 
}

// Run executes the configured alias command.
func ( *AliasBuilder) () (string, error) {
	switch .action {
	case "add":
		 := .c.FTAliasAdd(.ctx, .index, .alias)
		return .Result()
	case "del":
		 := .c.FTAliasDel(.ctx, .alias)
		return .Result()
	case "update":
		 := .c.FTAliasUpdate(.ctx, .index, .alias)
		return .Result()
	}
	return "", nil
}

// ----------------------
// ExplainBuilder for FT.EXPLAIN
// ----------------------
// ExplainBuilder is builder for FT.EXPLAIN
// EXPERIMENTAL: this API is subject to change, use with caution.
type ExplainBuilder struct {
	c       *Client
	ctx     context.Context
	index   string
	query   string
	options *FTExplainOptions
}

// NewExplainBuilder creates a new ExplainBuilder for FT.EXPLAIN commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context, ,  string) *ExplainBuilder {
	return &ExplainBuilder{c: , ctx: , index: , query: , options: &FTExplainOptions{}}
}

// Dialect sets dialect for EXPLAINCLI.
func ( *ExplainBuilder) ( string) *ExplainBuilder { .options.Dialect = ; return  }

// Run executes FT.EXPLAIN and returns the plan.
func ( *ExplainBuilder) () (string, error) {
	 := .c.FTExplainWithArgs(.ctx, .index, .query, .options)
	return .Result()
}

// ----------------------
// InfoBuilder for FT.INFO
// ----------------------

type FTInfoBuilder struct {
	c     *Client
	ctx   context.Context
	index string
}

// NewSearchInfoBuilder creates a new FTInfoBuilder for FT.INFO commands.
func ( *Client) ( context.Context,  string) *FTInfoBuilder {
	return &FTInfoBuilder{c: , ctx: , index: }
}

// Run executes FT.INFO and returns detailed info.
func ( *FTInfoBuilder) () (FTInfoResult, error) {
	 := .c.FTInfo(.ctx, .index)
	return .Result()
}

// ----------------------
// SpellCheckBuilder for FT.SPELLCHECK
// ----------------------
// SpellCheckBuilder is builder for FT.SPELLCHECK
// EXPERIMENTAL: this API is subject to change, use with caution.
type SpellCheckBuilder struct {
	c       *Client
	ctx     context.Context
	index   string
	query   string
	options *FTSpellCheckOptions
}

// NewSpellCheckBuilder creates a new SpellCheckBuilder for FT.SPELLCHECK commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context, ,  string) *SpellCheckBuilder {
	return &SpellCheckBuilder{c: , ctx: , index: , query: , options: &FTSpellCheckOptions{}}
}

// Distance sets MAXDISTANCE.
func ( *SpellCheckBuilder) ( int) *SpellCheckBuilder { .options.Distance = ; return  }

// Terms sets INCLUDE or EXCLUDE terms.
func ( *SpellCheckBuilder) ( bool,  string,  ...interface{}) *SpellCheckBuilder {
	if .options.Terms == nil {
		.options.Terms = &FTSpellCheckTerms{}
	}
	if  {
		.options.Terms.Inclusion = "INCLUDE"
	} else {
		.options.Terms.Inclusion = "EXCLUDE"
	}
	.options.Terms.Dictionary = 
	.options.Terms.Terms = 
	return 
}

// Dialect sets dialect version.
func ( *SpellCheckBuilder) ( int) *SpellCheckBuilder { .options.Dialect = ; return  }

// Run executes FT.SPELLCHECK and returns suggestions.
func ( *SpellCheckBuilder) () ([]SpellCheckResult, error) {
	 := .c.FTSpellCheckWithArgs(.ctx, .index, .query, .options)
	return .Result()
}

// ----------------------
// DictBuilder for FT.DICT* commands
// ----------------------
// DictBuilder is builder for FT.DICT* commands
// EXPERIMENTAL: this API is subject to change, use with caution.
type DictBuilder struct {
	c      *Client
	ctx    context.Context
	dict   string
	terms  []interface{}
	action string // add|del|dump
}

// NewDictBuilder creates a new DictBuilder for FT.DICT* commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context,  string) *DictBuilder {
	return &DictBuilder{c: , ctx: , dict: }
}

// Action sets the action for the dictionary builder.
func ( *DictBuilder) ( string) *DictBuilder {
	.action = 
	return 
}

// Add sets the action to "add" and requires terms.
func ( *DictBuilder) ( ...interface{}) *DictBuilder {
	.action = "add"
	.terms = 
	return 
}

// Del sets the action to "del" and requires terms.
func ( *DictBuilder) ( ...interface{}) *DictBuilder {
	.action = "del"
	.terms = 
	return 
}

// Dump sets the action to "dump".
func ( *DictBuilder) () *DictBuilder {
	.action = "dump"
	return 
}

// Run executes the configured dictionary command.
func ( *DictBuilder) () (interface{}, error) {
	switch .action {
	case "add":
		 := .c.FTDictAdd(.ctx, .dict, .terms...)
		return .Result()
	case "del":
		 := .c.FTDictDel(.ctx, .dict, .terms...)
		return .Result()
	case "dump":
		 := .c.FTDictDump(.ctx, .dict)
		return .Result()
	}
	return nil, nil
}

// ----------------------
// TagValsBuilder for FT.TAGVALS
// ----------------------
// TagValsBuilder is builder for FT.TAGVALS
// EXPERIMENTAL: this API is subject to change, use with caution.
type TagValsBuilder struct {
	c     *Client
	ctx   context.Context
	index string
	field string
}

// NewTagValsBuilder creates a new TagValsBuilder for FT.TAGVALS commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context, ,  string) *TagValsBuilder {
	return &TagValsBuilder{c: , ctx: , index: , field: }
}

// Run executes FT.TAGVALS and returns tag values.
func ( *TagValsBuilder) () ([]string, error) {
	 := .c.FTTagVals(.ctx, .index, .field)
	return .Result()
}

// ----------------------
// CursorBuilder for FT.CURSOR*
// ----------------------
// CursorBuilder is builder for FT.CURSOR* commands
// EXPERIMENTAL: this API is subject to change, use with caution.
type CursorBuilder struct {
	c        *Client
	ctx      context.Context
	index    string
	cursorId int64
	count    int
	action   string // read|del
}

// NewCursorBuilder creates a new CursorBuilder for FT.CURSOR* commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context,  string,  int64) *CursorBuilder {
	return &CursorBuilder{c: , ctx: , index: , cursorId: }
}

// Action sets the action for the cursor builder.
func ( *CursorBuilder) ( string) *CursorBuilder {
	.action = 
	return 
}

// Read sets the action to "read".
func ( *CursorBuilder) () *CursorBuilder {
	.action = "read"
	return 
}

// Del sets the action to "del".
func ( *CursorBuilder) () *CursorBuilder {
	.action = "del"
	return 
}

// Count for READ.
func ( *CursorBuilder) ( int) *CursorBuilder { .count = ; return  }

// Run executes the cursor command.
func ( *CursorBuilder) () (interface{}, error) {
	switch .action {
	case "read":
		 := .c.FTCursorRead(.ctx, .index, int(.cursorId), .count)
		return .Result()
	case "del":
		 := .c.FTCursorDel(.ctx, .index, int(.cursorId))
		return .Result()
	}
	return nil, nil
}

// ----------------------
// SynUpdateBuilder for FT.SYNUPDATE
// ----------------------
// SyncUpdateBuilder is builder for FT.SYNCUPDATE
// EXPERIMENTAL: this API is subject to change, use with caution.
type SynUpdateBuilder struct {
	c       *Client
	ctx     context.Context
	index   string
	groupId interface{}
	options *FTSynUpdateOptions
	terms   []interface{}
}

// NewSynUpdateBuilder creates a new SynUpdateBuilder for FT.SYNUPDATE commands.
// EXPERIMENTAL: this API is subject to change, use with caution.
func ( *Client) ( context.Context,  string,  interface{}) *SynUpdateBuilder {
	return &SynUpdateBuilder{c: , ctx: , index: , groupId: , options: &FTSynUpdateOptions{}}
}

// SkipInitialScan includes SKIPINITIALSCAN.
func ( *SynUpdateBuilder) () *SynUpdateBuilder {
	.options.SkipInitialScan = true
	return 
}

// Terms adds synonyms to the group.
func ( *SynUpdateBuilder) ( ...interface{}) *SynUpdateBuilder { .terms = ; return  }

// Run executes FT.SYNUPDATE.
func ( *SynUpdateBuilder) () (string, error) {
	 := .c.FTSynUpdateWithArgs(.ctx, .index, .groupId, .options, .terms)
	return .Result()
}