@@ -567,11 +567,8 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
567567 if options .SortByMax > 0 {
568568 queryArgs = append (queryArgs , "MAX" , options .SortByMax )
569569 }
570- if options .LimitOffset > 0 {
571- queryArgs = append (queryArgs , "LIMIT" , options .LimitOffset )
572- }
573- if options .Limit > 0 {
574- queryArgs = append (queryArgs , options .Limit )
570+ if options .LimitOffset >= 0 && options .Limit > 0 {
571+ queryArgs = append (queryArgs , "LIMIT" , options .LimitOffset , options .Limit )
575572 }
576573 if options .Filter != "" {
577574 queryArgs = append (queryArgs , "FILTER" , options .Filter )
@@ -766,11 +763,8 @@ func (c cmdable) FTAggregateWithArgs(ctx context.Context, index string, query st
766763 if options .SortByMax > 0 {
767764 args = append (args , "MAX" , options .SortByMax )
768765 }
769- if options .LimitOffset > 0 {
770- args = append (args , "LIMIT" , options .LimitOffset )
771- }
772- if options .Limit > 0 {
773- args = append (args , options .Limit )
766+ if options .LimitOffset >= 0 && options .Limit > 0 {
767+ args = append (args , "LIMIT" , options .LimitOffset , options .Limit )
774768 }
775769 if options .Filter != "" {
776770 args = append (args , "FILTER" , options .Filter )
0 commit comments