func (a *Autocompleter) AddTerms(terms ...Suggestion) error {
	conn := a.pool.Get()
	defer conn.Close()

	i := 0
	for _, term := range terms {

		args := redis.Args{a.name, term.Term, term.Score}
		if term.Incr {
			args = append(args, "INCR")
		}
		if term.Payload != "" {
			args = append(args, "PAYLOAD", term.Payload)
		}

		if err := conn.Send("FT.SUGADD", args...); err != nil {
			return err
		}
		i++
	}
	if err := conn.Flush(); err != nil {
		return err
	}
	for i > 0 {
		if _, err := conn.Receive(); err != nil {
			return err
		}
		i--
	}
	return nil
}
// AddTerms pushes new term suggestions to the index
AddTerms pushes new term suggestions to the index
// AddTerms pushes new term suggestions to the index
func (a *Autocompleter) AddTerms(terms ...Suggestion) error {
	conn := a.pool.Get()
	defer conn.Close()
	i := 0
	for _, term := range terms {
		args := redis.Args{a.name, term.Term, term.Score}
		if term.Incr {
			args = append(args, "INCR")
		}
		if term.Payload != "" {
			args = append(args, "PAYLOAD", term.Payload)
		}
		if err := conn.Send("FT.SUGADD", args...); err != nil {
			return err
		}
		i++
	}
	if err := conn.Flush(); err != nil {
		return err
	}
	for i > 0 {
		if _, err := conn.Receive(); err != nil {
			return err
		}
		i--
	}
	return nil
}
func ( a * Autocompleter ) AddTerms ( terms ... Suggestion ) error { conn := a . pool . Get ( ) defer conn . Close ( ) i := 0 for _ , term := range terms { args := redis . Args { a . name , term . Term , term . Score } if term . Incr { args = append ( args , " " ) } if term . Payload != " " { args = append ( args , " " , term . Payload ) } if err := conn . Send ( " " , args ... ) ; err != nil { return err } i ++ } if err := conn . Flush ( ) ; err != nil { return err } for i > 0 { if _ , err := conn . Receive ( ) ; err != nil { return err } i -- } return nil }
AddTerms pushes new term suggestions to the index
AddTerms pushes new term suggestions to the index